Last active
November 3, 2025 18:44
-
-
Save KaganAyten/ece39a44c9bb0281f24b710ca34b990b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEditor; | |
| using UnityEditor.SceneManagement; | |
| [InitializeOnLoad] | |
| public static class StartAtFirstScene | |
| { | |
| static StartAtFirstScene() | |
| { | |
| EditorApplication.playModeStateChanged += LoadStartScene; | |
| } | |
| private static void LoadStartScene(PlayModeStateChange state) | |
| { | |
| if (state == PlayModeStateChange.ExitingEditMode) | |
| { | |
| if (EditorSceneManager.GetActiveScene().name != "Menu") | |
| { | |
| EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); | |
| EditorSceneManager.OpenScene("Assets/Scenes/"Menu.unity"); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment