Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
ofb92's avatar
ofb92
Honored Guest
3 years ago

unity 2020 The scene is not loaded ERROR

Hi , I use Unity 2020.3.48f1 with Oculus integration version 53.1 and it gives me this error in the console everytime over and over again

"ArgumentException: The scene is not loaded.
UnityEngine.SceneManagement.Scene.GetRootGameObjects (System.Collections.Generic.List`1[T] rootGameObjects) (at <913bb12059fd4cef8da5cc94ad2f0933>:0)
UnityEngine.SceneManagement.Scene.GetRootGameObjects () (at <913bb12059fd4cef8da5cc94ad2f0933>:0)
Oculus.Interaction.Editor.UnityObjectAddedBroadcaster.HandleSceneOpened (UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode, System.Collections.Generic.HashSet`1[T] knownIds) (at Assets/Oculus/Interaction/Editor/AutoWiring/UnityObjectAddedBroadcaster.cs:87)
Oculus.Interaction.Editor.UnityObjectAddedBroadcaster+<>c__DisplayClass8_0.<.cctor>b__0 (UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode) (at Assets/Oculus/Interaction/Editor/AutoWiring/UnityObjectAddedBroadcaster.cs:44)
Oculus.Interaction.Editor.UnityObjectAddedBroadcaster..cctor () (at Assets/Oculus/Interaction/Editor/AutoWiring/UnityObjectAddedBroadcaster.cs:76)
Rethrow as TypeInitializationException: The type initializer for 'Oculus.Interaction.Editor.UnityObjectAddedBroadcaster' threw an exception.
Oculus.Interaction.Editor.UnityObjectAddedBroadcaster+<>c__DisplayClass8_0.<.cctor>b__1 () (at Assets/Oculus/Interaction/Editor/AutoWiring/UnityObjectAddedBroadcaster.cs:49)
UnityEditor.EditorApplication.Internal_CallHierarchyHasChanged () (at <25578071f6e44201aac745680e5c8dfc>:0)"

I can export my game but I still don't understand this error.

7 Replies

Replies have been turned off for this discussion
  • Having the same issue in Unity 2021.3.8f1 after updating the Oculus Integration package to the latest version. Happens when not in Play Mode (or when exiting Play Mode) everytime I load or unload an additive scene (whether I right click and load or unload, or remove, or drag a scene from the Project tab to the hierachy).

  • Did anyone ever figure out why this is occurring?  It seems to go away if I shut the editor down and reload, but it always finds its way back, eventually.  Unity 2021.3.23f1 Oculus Integration Version 57.0.

  • I can't believe after 7 months, Meta hasn't responded to this issue.  I upgraded my project to Unity 2022.3.27f1, ditched the legacy packages and installed the new SDKs and I still get this error.  I realize that it goes away after shutting the project down and restarting it.  But that isn't really a fix but rather a nuisance. 

  • metameta's avatar
    metameta
    Start Partner

    Getting this in Unity 2022.3.16f1 with v64 (and the past few sdks). Any ideas how to fix?

  • Had the problem aswel today. the weird part is that it only seems to be happening on my pc.
    eitherway, it looks like OVRProjectSetupUtils.cs is using the unity scenemanager in edit mode, which doesnt work.
    adding a check to the FindComponentInScene / FindComponentsInScene fixes the issue

    Note: this file is part of the package, so you can only modify it locally and it will be overwritten the next time you update it.

    	public static T FindComponentInScene<T>() where T : Component
    	{
    		//adding an if sco it doesnt run in edit mode
    		if (!Application.isPlaying) return null;
    
    		for (int i = 0; i < SceneManager.sceneCount; ++i)
    		{
    			var scene = SceneManager.GetSceneAt(i);
    			var rootGameObjects = scene.GetRootGameObjects();
    			foreach (var rootObject in rootGameObjects)
    			{
    				T obj = rootObject.GetComponentInChildren<T>(true);
    				if (obj != null)
    				{
    					return obj;
    				}
    			}
    		}
    		return null;
    	}
    
    	public static List<T> FindComponentsInScene<T>() where T : Component
    	{
    
    		var foundComponents = new List<T>();
    		//adding an if so it doesnt run in edit mode
    		if (!Application.isPlaying) return foundComponents;
    
    		for (int i = 0; i < SceneManager.sceneCount; ++i)
    		{
    			var scene = SceneManager.GetSceneAt(i);
    			var rootObjects = scene.GetRootGameObjects();
    			foreach (var rootObject in rootObjects)
    			{
    				var components = rootObject.GetComponentsInChildren<T>(true);
    				foundComponents.AddRange(components);
    			}
    		}
    
    		return foundComponents;
    	}