Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
843 B

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();
}
}
}