

If (supported = DeviceSupportedResult.ExitApplication)ĭebug.LogError("\n\nExiting application:\n\nThis. OculusLoader.cs #elif (UNITY_ANDROID & !UNITY_EDITOR) Tried all RuntimeInitializeLoadType annotations. I have an Android app, and the Oculus loader calls Application.Quit because the device is not an Oculus headset. I try to unload the Oculus loader, before he manages to load the plugin. Static void TryToDeinitializeOculusLoader() Sure wait for initialization to complete before calling this API. If you are using anything other than daydream, pass the name of that VR device to the LoadDevice function in the EnableVR() function.ĭoesn't work for me, I get this error when running my Android app.Ĭall to DeinitializeLoader without an initialized manager.Please make StartCoroutine(LoadDevice("daydream", true)) Ĭall EnableVR() to enable vr and DisableVR() to disable it. Complete code sample: IEnumerator LoadDevice(string newDevice, bool enable) This is known to work on some VR devices and not all VR devices. Then you can disable it in the Start function and enable it whenever you want. That requires this to be done a corutine function.Īlso, On some VR devices, you must go to Edit-> Project Settings-> Player and make sure that Virtual Reality Supported check-box is checked(true) before this will work. You should wait for a frame between each function call. When you want to enable it later on, call XRSettings.LoadDeviceByName("daydream") with the VR name followed by XRSettings.enabled = true. Include using UnityEngine.XR at the top.Ĭall XRSettings.LoadDeviceByName("") with empty string followed by XRSettings.enabled = false to disable VR in the start function to disable VR.
