Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice
  2. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

XR: Oculus system button/switch to Oculus home via OpenVR

Discussion in 'AR/VR (XR) Discussion' started by plmx, Jul 28, 2019.

  1. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    291
    Hi,

    when using the Oculus Rift + Touch via OpenVR, the Menu button (three lines) on the left controller lead to the SteamVR system menu, while the System button (Oculus "O") on the right controller leads to the Oculus system menu.

    My question is this: I understand that since the Oculus button is "reserved", I cannot query its state. However, I would still like to be notified somehow of the fact that the user just left the game and entered the Oculus menu (for pausing the game). Where in the XR API can I register to be notified of this event?

    Philip
     
  2. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    291
  3. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,300
    I would think you'd be better served by watching the state of the application. If the app enters the background, bring up your pause menu. Not tested, but something like this:
    Code (CSharp):
    1. void OnApplicationFocus(bool hasFocus)
    2. {
    3.     if (! hasFocus) {
    4.         // Do your pause stuff here
    5.     }
    6. }
     
    FlightOfOne and plmx like this.
  4. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    291
    I agree, and I actually tried to use the SteamVR equivalent of OnApplicationFocus in the past, which is the InputFocus event fired by SteamVR. However, that one is not called for Oculus button, only for the application menu button. However, point taken; I shall try Unity's OnApplicationFocus method as well.
     
    Schneider21 likes this.
  5. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    182
    @Schneider21 is correct, and if that doesn't get the job done, ping back, and we can bug it/fix it.
     
    Schneider21 and plmx like this.
  6. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    291
    @StayTalm_Unity @Schneider21 I'm sorry to report that it doesn't. Neither the Oculus Home nor the Steam Home (three lines, normally App Menu) are reported by OnApplicationFocus - whether on Oculus or OpenVR runtime.

    I've submitted a bug, case 1174547. It would be great if this could be resolved.
     
    Schneider21 likes this.
  7. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    182
    :(
    I'll have a look into it, it used to work.
     
    Schneider21 and plmx like this.
  8. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    291
    Thanks. I happened to have an HTC Cosmos here, where it does not work either (they call it the "Vive button"). This might or might not mean that the Vive is affected too (where, by the way, you can also press the button on the side of the headset which I did not know about before looking this issue up ;-) ). I can check for WMR too if you'd like.

    By the way: The OpenVR "InputFocus" event I talked about above works for the Vive's "Vive button", the Rift "App menu button" which leads to SteamVR via OpenVR, and the Windows Mixed Reality ("Windows button") headsets via OpenVR, but not for the Oculus home button.
     
    Last edited: Aug 6, 2019
  9. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    291
  10. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,403
    Any updates to this issue?
     
    AzurySimon likes this.
  11. AzurySimon

    AzurySimon

    Joined:
    Jul 16, 2018
    Posts:
    34
    Same question here, any news?
    Works on the Quest, but not in Standalone.

    Using:
    - Unity 2019.3.0f6
    - XR Management 3.0.5
    - Oculus XR Plugin 1.3.3
     
  12. BHSPitMonkey

    BHSPitMonkey

    Joined:
    Sep 14, 2016
    Posts:
    10
    It's almost time to celebrate this thread's birthday!

    Any updates on this? It's still a problem as of Unity 2020.1.0b16 and Oculus XR Plugin 1.3.4, and unless there's a workaround this blocks release via the Oculus Store since the game needs to take some actions to pause/mute itself when the system menu is open.
     
  13. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    226
    No news on this?
     
  14. Muskie

    Muskie

    Joined:
    Jan 21, 2017
    Posts:
    98
    If you're using OVRmanager/direct Oculus stuff, take a look here:
    https://developer.oculus.com/documentation/unity/unity-dash/

    "To check if your app has focus input, query OVRManager.hasInputFocus every frame. If your app has focus hasInputFocus will return true. If the user’s focus is elsewhere, like when the user opens the Dash menu or removes their HMD, hasInputFocus will return false."
     
  15. ReallyJonatanCrafoord

    ReallyJonatanCrafoord

    Joined:
    Jun 30, 2011
    Posts:
    5
    I'm having the same problem as everyone else in this thread, in Unity 2020.3 LTS. We need to detect if user opens Oculus Dash when they are running a SteamVR game so we can pause. OVRManager.hasInputFocus however always returns false if you're using SteamVR, even with an Oculus headset connected that clearly has focus. Has anyone managed to solve this?

    @StayTalm_Unity said they'd look into why Application.isFocused is not working for VR a year ago, any luck?
     
    Last edited: Sep 14, 2021
unityunity