Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question editor hangs, if enter playmode, without headset connected

Discussion in 'VR' started by mgear, Dec 2, 2022.

  1. mgear


    Aug 3, 2010
    doesn't seem right that it hangs,
    in steamvr you just get errors that no headset found..

    using 2021.3.12f1,
    openxr 1.5.3, oculus plugin 3.0.2, xr interaction toolkit 2.0.4

    [x] initialize xr on startup is enabled.
    (which i would expect to fail the init, not to hang editor..?)

    *if try running it manually, freezes on this line:
    Code (CSharp):
    1. yield return XRGeneralSettings.Instance.Manager.InitializeLoader();
    or manually specified loader, this line hangs:
    Code (CSharp):
    1. var initSuccess = m_SelectedXRLoader.Initialize();

    so next question is, how to detect if headset is available, before running that line, or some other way of detecting whether to use XR or PC mode.
    Last edited: Dec 2, 2022
  2. daedal


    Dec 19, 2013
    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.IntegratedSubsystemDescriptor`1:Create ()
    UnityEngine.IntegratedSubsystemDescriptor`1:CreateImpl ()
    UnityEngine.IntegratedSubsystemDescriptor:UnityEngine.ISubsystemDescriptor.Create ()
    UnityEngine.XR.Management.XRLoaderHelper:CreateSubsystem (List`1, String) at XRLoaderHelper.cs:[118]
    UnityEngine.XR.OpenXR.OpenXRLoaderBase:CreateSubsystem (List`1, 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.
  3. daedal


    Dec 19, 2013
    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.

    Is anyone else hitting this issue?
  4. nilagard


    Jan 13, 2017
    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.