I’m hitting the same issue after upgrading from Unity 2020.3.42 to 2021.3.16. It usually happens when the headset is inactive but it sometimes happens even when I have the headset on my head.
For me this happens automatically without manual initialization.
This is the call stack I’m seeing when it hangs:
UnityEngine.IntegratedSubsystemDescriptor1:Create () UnityEngine.IntegratedSubsystemDescriptor1:CreateImpl ()
UnityEngine.IntegratedSubsystemDescriptor:UnityEngine.ISubsystemDescriptor.Create ()
UnityEngine.XR.Management.XRLoaderHelper:CreateSubsystem (List1, String) at XRLoaderHelper.cs:[118] UnityEngine.XR.OpenXR.OpenXRLoaderBase:CreateSubsystem (List1, String) at OpenXRLoader.cs:[484]
UnityEngine.XR.OpenXR.OpenXRLoaderBase:CreateSubsystems () at OpenXRLoader.cs:[264]
UnityEngine.XR.OpenXR.OpenXRLoaderBase:InitializeInternal () at OpenXRLoader.cs:[237]
UnityEngine.XR.OpenXR.OpenXRLoaderBase:Initialize () at OpenXRLoader.cs:[183]
UnityEngine.XR.Management.XRManagerSettings:InitializeLoaderSync () at XRManagerSettings.cs:[190]
UnityEngine.XR.Management.XRGeneralSettings:InitXRSDK () at XRGeneralSettings.cs:[175]
UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad () at XRGeneralSettings.cs:[148]
Also for PC mode I have some logic to set XRGeneralSettings.Instance.InitManagerOnStart to false in Awake, but this logic is still getting run with a true value before my code can set it to false.
This issue continues to be a thorn in my side since the Quest 2/Quest Pro will quickly time out on the link connection, making the hang easy to hit. Even reconnecting the PC link will not resolve the hang and it will get the device in a bad state where I only see a black screen while connected to the PC.
While I’m sure the Meta Quest APIs are partly to blame, it still seems like a bug on the Unity end that it hangs without a timeout. And having to disable the Initialize XR on Startup setting to support PC mode is a nuisance.
Try making some logic to see if your headset is awake or not. Make the script run first via the script execution page, and if it’s not awake throw an error. Might be able to fix some unity jank.