TL;DR version: “Start with XR” enabled causes main loop to freeze somewhere; Update() only called once.
I ran in to an issue that I believe is a bug with the startup of the XR subsystem. I have a working 2022.3 project out in GitHub at GitHub - Corysia/Unity_VR_Examples: A collection of VR Examples that has a scene called “Pancake”. In this demo project, I’m showing how it is possible to try to detect whether or not a HMD is attached to the system. If it isn’t, the XR Rig is set inactive and another camera is made active. This is handled in DetectVR.cs
There are enough changes between Unity 2022.3 and the XRITK 2.4.3 and today’s Unity 6.0.27f1 and XRITK 3.0.7, that I wasn’t able to simply upgrade this project. I started working on a new version from scratch and found that if I disable my XR Rig and enable my desktop camera, the Update() method of every one of my scripts is only called once and never again.
It’s been difficult to debug this. No exception is thrown and the only error I’ve seen has been one I expect to see when running on a Mac:
Failed to load openxr runtime loader.
UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad () (at ./Library/PackageCache/com.unity.xr.management/Runtime/XRGeneralSettings.cs:148)
Windows doesn’t present any errors, so I don’t believe this error is related to the problem.
I’ve tried to trace this thru with a debugger, but it eventually hits code I don’t have source for and I lose my place.