Heroes_of_Hiis/Assets/Oculus/Platform/Scripts/CallbackRunner.cs

44 lines
843 B
C#
Raw Normal View History

2022-03-07 15:52:41 +00:00
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();
}
}
}