Search Unity

Bug Opening Oculus Universal Menu Breaks Headset Tracking

Discussion in 'VR' started by brazzoni, Jan 24, 2022.

  1. brazzoni

    brazzoni

    Joined:
    Sep 2, 2021
    Posts:
    13
    Expected Behaviour:
    User opens Oculus Universal Menu. App Pauses, but the 3D environment's position and rotation updates. For example, if you pause the game, you can still look around at the environment like you normally would. You just can't interact with it.

    Real Behaviour:
    User opens Oculus Universal Menu. App Pauses, but the 3D environment sticks to the users headset. The users view of the environment is always the same as what it was when the app paused. If the users turns their head upside down, the 3D environment is also turned upside down. It's the same behaviour as trying to run a project from the editor with the XR Device Simulator still enabled. If the user turns to the left, the view of the 3D environment moves to the left, and the user does not see anything new.

    Key Discoveries:
    This only happens on my built version of the App. I've tried building the app with and without development mode.

    A fresh project with the core VR basics (XR Origin, Up to date packages, Project Settings), results in the expected behaviour.

    I tried to create a new project, and I slowly started adding packages from the bugged project. I was always getting the expected behavior on builds. I added a scene, and the app started producing the Real Behaviour again, the environment was stuck to the headset's tracking. I tried removing the scene from the hierarchy and the build, but the app still produced real behaviour.
     
    ykarp, Aldeminor and kayb14 like this.
  2. brazzoni

    brazzoni

    Joined:
    Sep 2, 2021
    Posts:
    13
    Just to answer my own question incase anyone every does a search and finds it here. Somewhere in my git history, the runInBackground line in ProjectSettings.asset changed from runInBackground: 1 to runInBackground: 0. This is kinda weird because the runInBackground option isn't exposed in the project settings for android section. This straight up broke my pausing though.

    so runInBackground must be 1/yes/ticked. See my next reply for how to do this. Currently, It can't be done through the editor.
     
    Last edited: Jan 31, 2022
  3. brazzoni

    brazzoni

    Joined:
    Sep 2, 2021
    Posts:
    13
    I had to go into the actual project settings file "ProjectSettings.asset" which is in <projectRoot>/ProjectSettings/ProjectSettings.Asset

    runInBackground was roughly on line 79. I changed it from 0 to 1


    Unity periodically changes it from 1 back to 0. That's the real bug here. Haven't been able to track down exactly when this happens yet.

    Going into the stand alone section of Edit > Project Settings > Player > Resolution
    and changing run in background to 1/ticked doesn't fix this problem.
     
    Last edited: Apr 5, 2022
  4. Ruud3DV

    Ruud3DV

    Joined:
    Jan 25, 2016
    Posts:
    7
    Thanks for this workaround, works like a charm!
     
  5. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I'm wondering if this is linked to the behaviour I am seeing with my project where if on Quest 2 using Oculus Plugin through XR Plugin Management, background rendering works but if I build to the Quest 2 using OpenXR plugin, background rendering doesn't work. The only thing I am changing at this point is XR Plugin Management > Plugins and disable/enable Oculus and OpenXR separately before building.

    I think in this case it must be OpenXR not supporting background rendering on Meta Quest 2 yet but Oculus Plugin does
    https://forum.unity.com/threads/cas...ng-of-background-app-view-head-track.1259831/
     
    kayb14 likes this.
  6. brazzoni

    brazzoni

    Joined:
    Sep 2, 2021
    Posts:
    13
    That might be something that causes it. I know there was a recent bug report for this. Apparently it was caused by switching between pc and android in Build Settings. Supposedly that bug was fixed, but I am still noticing it reverts to 1 from something still.
     
    Aldeminor and ROBYER1 like this.
  7. Bhanu_Audichya

    Bhanu_Audichya

    Joined:
    Sep 30, 2020
    Posts:
    2
    Thank you!!
     
  8. Aldeminor

    Aldeminor

    Joined:
    May 3, 2014
    Posts:
    18
    So to conclude, it seems like the Run in background option is hidden from Android project settings because it supposed to be irrelevant, but in fact it is relevant for this platform and can cause undesired effect.
     
  9. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    40
    Another +1 for this thread - thanks so much, been stuck for weeks on this and it was the cause of pause mode being broken in the latest builds of a project using Unity XRI 2.4.1 and Unity 2022.3.4f1 which is all absolutely latest as I write this. My project has followed a tortured route from Unity 2021 so not sure if the bug/feature is still present but having fixed it I will keep an eye out. Thanks "bigly" to OP and contributors here.
     
    Verdant88 and ROBYER1 like this.