Slight modification to StartupSceneLoader

Added in a “transition back” so once you kill play mode, you’re taken back to where you were

    private static void LoadStartupScene(PlayModeStateChange state)
    {
        switch (state)
        {
            case PlayModeStateChange.ExitingEditMode:
                EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
                break;
            case PlayModeStateChange.EnteredPlayMode:
                previousScene = EditorSceneManager.GetActiveScene().buildIndex;

                if (EditorSceneManager.GetActiveScene().buildIndex != 0)
                {
                    EditorSceneManager.LoadScene(0);
                }
                break;
            case PlayModeStateChange.ExitingPlayMode when EditorSceneManager.GetActiveScene().buildIndex != previousScene:
                EditorSceneManager.LoadScene(previousScene);
                break;
        }
    }
2 Likes

What a small but great change! Thanks for this

Privacy & Terms