Editor/LevelsTools.cs
/// <summary>
/// Restores scenes after we stopped playing to the state it was before
/// </summary>
Restores scenes after we stopped playing to the state it was before
Restores scenes after we stopped playing to the state it was before
static void RestoreScenes()
        {
            if (Application.isPlaying)
            {
                return;
            }
            if (USSEditorPrefs.vars.EditorSceneLaunchMode)
            {
                Scene n = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
                for (int i = 0; i < USSEditorPrefs.prefs.PreviousScenes.Count; i++)
                {
                    EditorSceneManager.OpenScene(USSEditorPrefs.prefs.PreviousScenes[i], OpenSceneMode.Additive);
                }
                EditorSceneManager.CloseScene(n, true);
                USSEditorPrefs.vars.EditorSceneLaunchMode = false;
                EditorSceneManager.RestoreSceneManagerSetup(USSEditorPrefs.prefs.RestoreSceneSetup());
            }
        }
static void RestoreScenes ( ) { if ( Application . isPlaying ) { return ; } if ( USSEditorPrefs . vars . EditorSceneLaunchMode ) { Scene n = EditorSceneManager . NewScene ( NewSceneSetup . EmptyScene , NewSceneMode . Single ) ; for ( int i = 0 ; i < USSEditorPrefs . prefs . PreviousScenes . Count ; i ++ ) { EditorSceneManager . OpenScene ( USSEditorPrefs . prefs . PreviousScenes [ i ] , OpenSceneMode . Additive ) ; } EditorSceneManager . CloseScene ( n , true ) ; USSEditorPrefs . vars . EditorSceneLaunchMode = false ; EditorSceneManager . RestoreSceneManagerSetup ( USSEditorPrefs . prefs . RestoreSceneSetup ( ) ) ; } }
Restores scenes after we stopped playing to the state it was before
Restores scenes after we stopped playing to the state it was before
//If we detect we launched level already //clean all up //reopen previously stored scenes //reset flag  //restore the setup to what it was before.