- Home /
Reload game scene when take away Gear VR
Where can I find the function that turn off the Gear VR display ?
When you put on or take away Gear VR it turn off or on the display, I need to check this function or bool and add a function that reload my game level when the user take off the oculus I done a search on all OVR codes but I dont found the class that do this, have someway to access when the player take away the Gear VR ? Or a bool or something like that
Answer by PrimacyUnity · Jul 08, 2015 at 03:36 PM
there is a method in OVRPlatformMenu called OnApplicationFocus...you may be able to call Application.LoadScene("your scene") within that to effectively reset the scene
Does this only work using the OVR package? When using Unity's default behavior for enabling VR, my application closes when the Gear VR is disconnected.
Answer by tteneder · Jun 03, 2016 at 10:37 AM
By now there is a solution for Unity 5. You have to use the Oculus Utilities for Unity 5. There you'll have a bool property named:
OVRPlugin.userPresent
You may have to make sure there's an instance of OVRManager present.
The mentioned OnApplicationPause does work, but only after about 10 seconds after you took the Gear VR off, which is too long for many cases.
get the Oculus Utilities for Unity 5 here: https://developer.oculus.com/downloads
Source of solution: https://forums.oculus.com/de/discussion/31869/samsung-gear-vr-sdk-questions-unity3d-5-0
hth, @justin_iSO
Answer by zerograssi · Oct 17, 2016 at 12:56 PM
I used this "hand made" solution to manage the standby: Every second check the device time (hour, minutis and seconds express in seconds) and compared the data with a previously saved time (using PlayerPref). if the current time exceeds the time saved for 15 seconds or more (my timeout) the viewer was in standby and i reload the scene. Otherwise i save the new time on the device.