概要
using UnityEditor; using UnityEngine; [InitializeOnLoad] public static class Example { static Example() { EditorApplication.playModeStateChanged += OnChanged; } private static void OnChanged( PlayModeStateChange change ) { if ( !Progress.running ) return; if ( change != PlayModeStateChange.ExitingEditMode ) return; Debug.Log( "再生キャンセル" ); EditorApplication.isPlaying = false; } }