clean project
This commit is contained in:
43
Assets/Oculus/Platform/Scripts/CallbackRunner.cs
Normal file
43
Assets/Oculus/Platform/Scripts/CallbackRunner.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Platform
|
||||
{
|
||||
public class CallbackRunner : MonoBehaviour
|
||||
{
|
||||
[DllImport(CAPI.DLL_NAME)]
|
||||
static extern void ovr_UnityResetTestPlatform();
|
||||
|
||||
public bool IsPersistantBetweenSceneLoads = true;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
var existingCallbackRunner = FindObjectOfType<CallbackRunner>();
|
||||
if (existingCallbackRunner != this)
|
||||
{
|
||||
Debug.LogWarning("You only need one instance of CallbackRunner");
|
||||
}
|
||||
if (IsPersistantBetweenSceneLoads)
|
||||
{
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
Request.RunCallbacks();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
ovr_UnityResetTestPlatform();
|
||||
#endif
|
||||
}
|
||||
|
||||
void OnApplicationQuit()
|
||||
{
|
||||
Callback.OnApplicationQuit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user