diff --git a/Assets/VRTK/Source/Scripts/Utilities/VRTK_SharedMethods.cs b/Assets/VRTK/Source/Scripts/Utilities/VRTK_SharedMethods.cs index 4727feb14..f022ebadb 100644 --- a/Assets/VRTK/Source/Scripts/Utilities/VRTK_SharedMethods.cs +++ b/Assets/VRTK/Source/Scripts/Utilities/VRTK_SharedMethods.cs @@ -789,13 +789,13 @@ private static IEnumerable FindEvenInactiveComponentsInValidScenes(bool se List allSceneResults = new List(); for (int sceneIndex = 0; sceneIndex < SceneManager.sceneCount; sceneIndex++) { - allSceneResults.AddRange(FindEventInactiveComponentsInScene(SceneManager.GetSceneAt(sceneIndex), stopOnMatch)); + allSceneResults.AddRange(FindEvenInactiveComponentsInScene(SceneManager.GetSceneAt(sceneIndex), stopOnMatch)); } results = allSceneResults; } else { - results = FindEventInactiveComponentsInScene(SceneManager.GetActiveScene(), stopOnMatch); + results = FindEvenInactiveComponentsInScene(SceneManager.GetActiveScene(), stopOnMatch); } return results; @@ -807,9 +807,14 @@ private static IEnumerable FindEvenInactiveComponentsInValidScenes(bool se /// The scene to search. This scene must be valid, either loaded or loading. /// If true, will stop searching objects as soon as a match is found. /// - private static IEnumerable FindEventInactiveComponentsInScene(Scene scene, bool stopOnMatch = false) + private static IEnumerable FindEvenInactiveComponentsInScene(Scene scene, bool stopOnMatch = false) { List results = new List(); + if(!scene.isLoaded) + { + return results; + } + foreach (GameObject rootObject in scene.GetRootGameObjects()) { if (stopOnMatch)