File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Assets/VRTK/Source/Scripts/Utilities Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -789,13 +789,13 @@ private static IEnumerable<T> FindEvenInactiveComponentsInValidScenes<T>(bool se
789789 List < T > allSceneResults = new List < T > ( ) ;
790790 for ( int sceneIndex = 0 ; sceneIndex < SceneManager . sceneCount ; sceneIndex ++ )
791791 {
792- allSceneResults . AddRange ( FindEventInactiveComponentsInScene < T > ( SceneManager . GetSceneAt ( sceneIndex ) , stopOnMatch ) ) ;
792+ allSceneResults . AddRange ( FindEvenInactiveComponentsInScene < T > ( SceneManager . GetSceneAt ( sceneIndex ) , stopOnMatch ) ) ;
793793 }
794794 results = allSceneResults ;
795795 }
796796 else
797797 {
798- results = FindEventInactiveComponentsInScene < T > ( SceneManager . GetActiveScene ( ) , stopOnMatch ) ;
798+ results = FindEvenInactiveComponentsInScene < T > ( SceneManager . GetActiveScene ( ) , stopOnMatch ) ;
799799 }
800800
801801 return results ;
@@ -807,9 +807,14 @@ private static IEnumerable<T> FindEvenInactiveComponentsInValidScenes<T>(bool se
807807 /// <param name="scene">The scene to search. This scene must be valid, either loaded or loading.</param>
808808 /// <param name="stopOnMatch">If true, will stop searching objects as soon as a match is found.</param>
809809 /// <returns></returns>
810- private static IEnumerable < T > FindEventInactiveComponentsInScene < T > ( Scene scene , bool stopOnMatch = false )
810+ private static IEnumerable < T > FindEvenInactiveComponentsInScene < T > ( Scene scene , bool stopOnMatch = false )
811811 {
812812 List < T > results = new List < T > ( ) ;
813+ if ( ! scene . isLoaded )
814+ {
815+ return results ;
816+ }
817+
813818 foreach ( GameObject rootObject in scene . GetRootGameObjects ( ) )
814819 {
815820 if ( stopOnMatch )
You can’t perform that action at this time.
0 commit comments