WuhuIslandTesting/Library/PackageCache/com.unity.xr.oculus@4.0.0/Runtime/RegisterUpdateCallback.cs
2025-01-07 02:06:59 +01:00

38 lines
No EOL
933 B
C#

#if UNITY_STANDALONE_WIN && !UNITY_EDITOR
#define OCULUSPLUGIN_WINDOWS_PLATFORM_ONLY
#endif
using UnityEngine;
namespace Unity.XR.Oculus
{
internal static class RegisterUpdateCallback
{
internal static void Initialize()
{
Application.onBeforeRender += Update;
}
internal static void Deinitialize()
{
Application.onBeforeRender -= Update;
}
private static void Update()
{
//Detect if input focus lost or acquired.
InputFocus.Update();
// Update our session state
OculusSession.Update();
#if OCULUSPLUGIN_WINDOWS_PLATFORM_ONLY
//Detect if App is closed from Oculus dash menu and close Windows based App as well.
if (NativeMethods.GetAppShouldQuit())
{
Application.Quit();
}
#endif
}
}
}