Skip to main content
New Participant
January 25, 2024
Solved

Meta XR Simulator starts only once

  • January 25, 2024
  • 4 replies
  • 4264 views

Hi, I have a problem with the Meta XR Simulator v60 in Unity 2023.2.7f1 and Meta SDK v60.

When i start a Synthetic Environment Server, set the simulator to active and start the game, everything works as intended. But only exactly once!

Afterwards i get always these 2 errors:

  • XR Management has already initialized an active loader in this scene. Please make sure to stop all subsystems and deinitialize the active loader before initializing a new one.
  • Failed to set DeveloperMode on Start. 

They appear each time until i restart Unity completely (e.g. just stopping the server does not work unfortunately).

I think everything should be set up correctly (e.g. plug-In provider is set to Oculus and all the items in the verify checklist are applied), because it runs without problems once... But then it stops, no idea why.

Any ideas?

 

This topic has been closed for replies.
Best answer by ManInBl4ck

Think i found a solution, based on this. 

If anybody should have the same problem, just place that script as a component somewhere in the scene. It ensures, that stuff is correctly uninitialized before re-initializing:

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

public class VRInit : MonoBehaviour {

#if UNITY_EDITOR

    private void Start() {
        EnableXR();
    }

    private void OnDestroy() {
        DisableXR();
    }

    public void EnableXR() {
        StartCoroutine(StartXRCoroutine());
    }

    public void DisableXR() {
        XRGeneralSettings.Instance?.Manager?.StopSubsystems();
        XRGeneralSettings.Instance?.Manager?.DeinitializeLoader();
    }
 
    public IEnumerator StartXRCoroutine() { 
        if(XRGeneralSettings.Instance == null){
            XRGeneralSettings.Instance = XRGeneralSettings.CreateInstance<XRGeneralSettings>();
        }

        if(XRGeneralSettings.Instance.Manager == null){
            yield return new WaitUntil( () => XRGeneralSettings.Instance.Manager != null);
        }

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

#endif

}

 

4 replies

ManInBl4ckAuthorAnswer
New Participant
January 28, 2024

Think i found a solution, based on this. 

If anybody should have the same problem, just place that script as a component somewhere in the scene. It ensures, that stuff is correctly uninitialized before re-initializing:

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

public class VRInit : MonoBehaviour {

#if UNITY_EDITOR

    private void Start() {
        EnableXR();
    }

    private void OnDestroy() {
        DisableXR();
    }

    public void EnableXR() {
        StartCoroutine(StartXRCoroutine());
    }

    public void DisableXR() {
        XRGeneralSettings.Instance?.Manager?.StopSubsystems();
        XRGeneralSettings.Instance?.Manager?.DeinitializeLoader();
    }
 
    public IEnumerator StartXRCoroutine() { 
        if(XRGeneralSettings.Instance == null){
            XRGeneralSettings.Instance = XRGeneralSettings.CreateInstance<XRGeneralSettings>();
        }

        if(XRGeneralSettings.Instance.Manager == null){
            yield return new WaitUntil( () => XRGeneralSettings.Instance.Manager != null);
        }

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

#endif

}

 

New Participant
August 12, 2024

Thanks heaps man! 
Also, don't forget to save and close and re-open unity after adding this script. That worked for me!  🙂

Participant
April 30, 2025

Thank you so much, Ive been trying to find a solution forever!!