Search Unity

Access to proximity sensor

Discussion in 'AR/VR (XR) Discussion' started by pao_olea, Mar 10, 2016.

  1. pao_olea

    pao_olea

    Joined:
    Dec 31, 2015
    Posts:
    16
    Hi everyone.

    I need have access to the proximity sensor for Gear VR, can your help me?

    thanks.
    Livensy
     
  2. EarMaster

    EarMaster

    Joined:
    Mar 7, 2013
    Posts:
    39
    Did you have any success accessing the proximity sensor data?
     
  3. pao_olea

    pao_olea

    Joined:
    Dec 31, 2015
    Posts:
    16
    EarMaster, well, yes and not. The thing is I can't have access directly to the sensor, so, the only way to detect when the user is gone, is when the application is in pause, so I use this code for C#:

    private void OnApplicationPause(bool pauseStatus){
    // here you code
    }

    I asked to many people, included teachers of Unity, and the only one who answered me, said to me this "This is probably something best asked on the Oculus forums".

    So, good luck.
     
  4. EarMaster

    EarMaster

    Joined:
    Mar 7, 2013
    Posts:
    39
    I have tried this, but OnApplicationPause is only called at the beginning of the scene. Which version of Unity are you using, maybe this behavior was changed at some point.
     
  5. pao_olea

    pao_olea

    Joined:
    Dec 31, 2015
    Posts:
    16
    I use Unity 5.3.2. When I test the code OnApplicationPause in the desktop, only works at the beginning of the scene, but when you test the application at the Gear VR, the code works fine. If you take off the Gear VR, the application works for 10 seconds and then pauses.
     
  6. EarMaster

    EarMaster

    Joined:
    Mar 7, 2013
    Posts:
    39
    Thanks for your reply. I was not aware of the delay, but I got it to work now.