ソースコード
using UnityEditor; using UnityEditor.SceneManagement; [InitializeOnLoad] public static class Example { static Example() { EditorApplication.playModeStateChanged += change => { if ( change != PlayModeStateChange.ExitingEditMode ) return; StageUtility.GoToMainStage(); }; } }