Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Head mounting detection in Gear VR

Discussion in 'AR/VR (XR) Discussion' started by atsamy, Jul 20, 2015.

  1. atsamy

    atsamy

    Joined:
    Feb 28, 2013
    Posts:
    5
    how can i detect if a player put on the gear VR, there supposed to be a sensor to detect this is there a way to know inside unity
     
  2. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    399
  3. EarMaster

    EarMaster

    Joined:
    Mar 7, 2013
    Posts:
    39
    As far as I'm able to tell OnApplicationPause isn't fired (any more). Do you have any other ideas how to detect this event of the Gear VR being put on and/or off.
     
  4. Andrew_at_That_Wonderful_Lemon_Co

    Andrew_at_That_Wonderful_Lemon_Co

    Joined:
    Feb 1, 2014
    Posts:
    23
    This looks like it is the same for me - is this a bug?
     
  5. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    179
    We detect this by just storing the current system time in an Update function and compare it next frame. If the difference between these timestamps is too big e.g. > 2 seconds then you can assume that the GearVR was removed. This would help you only if you getting back to the GearVR, but not before. You can also check the OnApplicationFocus event:

    http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationFocus.html