Oculus Quest 2 and Quest Link failing to start

Hi all,

I’m having real difficulty migrating to the new XR system in 2021.
I’m only using the Quest 2 on Quest Link and only need the headset to work when the user enables it via UI. I only need the headset to work, so don’t need any controllers etc.

I have the XR Plugin and Oculus plugin installed with the latest versions.
Oculus is selected in Plug-in Providers under XR Plug-In Management

I have the Oculus software running and Quest Link selected.
Initialize XR on Startup is off.

This is the code I have attached to the UI button.

IEnumerator StartXR()
{
    Debug.Log("Initializing XR...");
    yield return XRGeneralSettings.Instance.Manager.InitializeLoader();

    if (XRGeneralSettings.Instance.Manager.activeLoader == null)
    {
        Debug.LogError("Initializing XR Failed. Check Editor or Player log for details.");
    }
    else
    {
        Debug.Log("Starting XR...");
        XRGeneralSettings.Instance.Manager.activeLoader.Start();
    }
}

void StopXR()
{
    Debug.Log("Stopping XR...");

    if (XRGeneralSettings.Instance.Manager.activeLoader != null)
    {
        XRGeneralSettings.Instance.Manager.activeLoader.Stop();
        Debug.Log("XR stopped completely.");
    }

    Camera.main.ResetAspect();
}

This works the first time I run it in the editor but after I always get this error message:

Failed to set DeveloperMode on Start.

It’s as though something isn’t being reset after exiting play mode.

Someone else asked on the forums but was never resolved:

I’m only building for Windows.

Unity: 2021.2.4f1
XR Plugin: 4.2.1
Oculus XR Plugin: 1.11.2
OpenXR Plugin: 1.2.8

Has anyone else come across this issue and manage to fix it?

Yes, I had this problem. Turned out I forgot to run “StopXR” at the end of a session (ended up working when I put it in “OnDestroy”).

My script is a little bit different:

using System.Collections;
using UnityEngine;
using UnityEngine.XR.Management;

public class VRInitializer : MonoBehaviour
{
    private void Start()
    {
EnableXR();
    }
    private void OnDestroy()
    {
        DisableXR();
    }
    public void EnableXR()
    {
        StartCoroutine(StartXRCoroutine());
    }
    public void DisableXR()
    {
        Debug.Log("Stopping XR...");
        XRGeneralSettings.Instance.Manager.StopSubsystems();
        XRGeneralSettings.Instance.Manager.DeinitializeLoader();
        Debug.Log("XR stopped completely.");
    }

    public IEnumerator StartXRCoroutine()
    {
        Debug.Log("Initializing XR...");
        yield return XRGeneralSettings.Instance.Manager.InitializeLoader();

        if (XRGeneralSettings.Instance.Manager.activeLoader == null)
        {
            Debug.LogError("Initializing XR Failed. Check Editor or Player log for details.");
        }
        else
        {
            Debug.Log("Starting XR...");
            XRGeneralSettings.Instance.Manager.StartSubsystems();
        }
    }
}
3 Likes

Brilliant, thanks for that, this issue was driving me mad. Do you think this is a Unity problem, an Oculus problem or a problem with OpenXR? Thanks again mate.

That fixed the issue for me. Thanks