Search Unity

How do I stop the Oculus Rift from pausing my app when taken off

Discussion in 'AR/VR (XR) Discussion' started by col000r, Sep 4, 2016.

  1. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    699
    When I take off the headset it pauses my app and the mirrored screen goes to black. How can I stop this behaviour? (Other than taping over the sensor) I want it to continue to run my app and continue to mirror to the screen.
     
    FaffyWaffles, levlaj and Hashton like this.
  2. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    Ditto
     
    FaffyWaffles and Hashton like this.
  3. Brocan

    Brocan

    Joined:
    Mar 22, 2012
    Posts:
    45
    No response? i've the same problem, pausing the app and putting mirror image black is f**cking anoying...
     
  4. joshenes

    joshenes

    Joined:
    Apr 18, 2014
    Posts:
    48
    Edit OVRManager.cs from the Oculus Utilities package.
    Find the line "internal static bool runInBackground = false;", change false to true.
     
    astracat111 and Martinez-Vargas like this.
  5. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    It would be really nice if Unity wrapped this up into VRSettings to allow us to remain model/brand agnostic. I've avoided downloading the OVR SDK so the application would work with either the Rift or Vive.
     
    levlaj likes this.
  6. UmairEm

    UmairEm

    Joined:
    Nov 7, 2015
    Posts:
    31
    Don't you think that OVR SDK is a requirement to get your app approved on Oculus store?
    Please correct me if I am wrong :)
     
  7. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    I'm not planning to use the Oculus store.

    Either way, I feel it's unreasonable to be required to use either the OVR player controller or OVR camera when I need to support the Vive as well (plus whatever other VR headsets that come out next year).
     
  8. joshenes

    joshenes

    Joined:
    Apr 18, 2014
    Posts:
    48
    You could probably just strip out the minimal bit of relevant code from the Oculus Utilities and run it when VRSettings.loadedDeviceName == "Oculus". I've done something similar to be able to set OpenVR into seated mode without having the whole package cluttering up my project.
     
  9. Kubic75

    Kubic75

    Joined:
    Jan 2, 2017
    Posts:
    83
    The bool "internal static bool runInBackground" is not available anymore in OVRManager.cs (ovr_unity_utilities_1.15.0).

    Any alternative?
     
  10. erre-rox

    erre-rox

    Joined:
    Dec 3, 2012
    Posts:
    23
    Any news on this?
    We need to prevent Oculus to pause/stop the application when the HeadSet is removed.

    Thank you.
     
  11. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    The way I dealt with this annoying issue, is to use the Oculus camera rig NOT Unity's built in camera VR.
    This allows some flexibility as there are more settings available, for example OVRPlugin.ignoreVrFocus = true; will always keep the Oculus enabled even when the headset is removed.

    As far as I'm aware this is the only way as Unity has not given us the ability to control this.

    Let me know how you get on
     
    Last edited: Apr 13, 2018
  12. EdBlais

    EdBlais

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    311
    Hey guys, I'm curious as to what the use case is for this?

    Currently Oculus VRFocus doesn't effect the editor and you can still get orientation data and render, but for standalone (so long as Run In Background is enabled) we'll stop rendering camera's that are targeting eyes, but we will still render cameras that are set to render without XR tracking. We could make a general solution ignore VRFocus that would continue to render the VR cameras in this case, but a use case would be nice.

    Are you trying to use this for testing or is this a feature of your application? I'm not sure why you'd want to continue rendering the VR cameras if the HMD isn't being used.
     
  13. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    In our existing design, we require a program operator who is not using the HMD to have access to a desktop interface which controls the program settings for the virtual reality experience. This operator needs to have access to the desktop settings regardless of if there is a user currently wearing the headset.

    Ideally, we would like the HMD to display a "please wait" screen while the app is being configured from the desktop.

    We have all of this functionality working fine in the Unity editor with the existing OVR scripts and Unity canvases. It is only when the app is compiled as standalone that we run into the sensor sleep issue which prevents the desktop operator from accessing the app from the computer monitor unless the headset is being worn.
     
    Last edited: Apr 18, 2018
  14. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    Looks like we were able to achieve the desired result with a combination of using a second camera in the scene set to Target Eye (none) for our main display, and then select "Run In Background" under the player settings > resolution
     
  15. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    We had a similar set-up as huxley.

    The menu system would be operated when the headset was not on (i.e. entering user details), once that was done the user would then wear the headset and play the game. The issue was the application would pause once the headset was removed.

    This was a couple of years ago so maybe things have changed within Unity since then.
     
  16. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    Same. The app I was working on at the time used a hybrid of the desktop and headset hybrid where the UI control could be interacted with either in VR or by mouse. This was necessary because sometimes there were complicated settings that wouldn't work too well in VR space (like typing a note, for example). So you'd remove the headset, type something, click on other things, etc. then re-enter VR mode.

    Of course, having the app pause while the headset was removed defeated all that.
     
    yoyyoffg likes this.
  17. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    488
    any solution for this yet?
     
    Propagant likes this.
  18. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    488
    Forget it. Oculus Rift and Rift S will stop from next year. Concentrate more on Oculus Quest. It is better.
     
  19. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    But the truth is, whenever you target any platform you're porting. I watch these YT videos about the engineering that went into making Gameboy games on 8KB of VRAM, thankfully all we have to do these days is change some lines of code.

    I second that the Oculus Quest 2 might be the platform to target but ummm....with the whole 'requiring your real name' thing from FB, I don't see SteamVR stalling any time soon.
     
  20. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    488
    Yea well looks like our data will be collected real soon.
     
  21. julienkay

    julienkay

    Joined:
    Nov 12, 2013
    Posts:
    170
    I have that same feature request, but for a standalone Android app on Oculus Quest. The use case is to create a networked app. Currently my networked app looses connection to the server, when the headset is not worn, because it stops sending data. So I don't care about keeping rendering, only about the fact that the app should keep running.
     
  22. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    140
    Uhhh... Devs?

    This is a VRC requirement.

    You won't be able to get your game on the store without this occuring. For networked apps, you should check for VR Focus loss and send a signal to alert the server that this has occured.

    You can disable the proximity sensor for development purposes however. you can do this through the Oculus Developer Hub app.
     
    ThomasClarte likes this.
  23. ThomasClarte

    ThomasClarte

    Joined:
    Jun 29, 2021
    Posts:
    1
    BrBarry likes this.
  24. BrBarry

    BrBarry

    Joined:
    Jul 16, 2019
    Posts:
    10
    Agree, as it might not be controlled with code, but could also be settings on the device. You could also extent the sleep mode timing. For the Quest 2, it's in the 'Power Setting'. Mine is default set to 15sec Auto-Sleep. You can extend this to 15mins.