Opening Oculus Universal Menu Breaks Headset Tracking

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.

3 Likes

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.

5 Likes

I had to go into the actual project settings file “ProjectSettings.asset” which is in /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.

9 Likes

Thanks for this workaround, works like a charm!

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

1 Like

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.

2 Likes

Thank you!!

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.

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.

3 Likes

A quicker fix I have found, is that the “Run in the background” setting isn’t hidden in the “settings for Windows, Mac, Linux” tab. It is in Project settings/Player/(Choose “Settings for Windows, Mac, Linux” tab instead of Android)/Resolution and presentation/Resolution. There you can set “Run in the background” field to true, and it fixes the problem on Android too.

1 Like