diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs index ba1b4ab57..1602a290b 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs @@ -54,9 +54,28 @@ static ScenePlaybackDetector() { #if UNITY_2017_2_OR_NEWER EditorApplication.playModeStateChanged += e => + { + if (e == PlayModeStateChange.ExitingEditMode) + { + AboutToStartScene = true; + } + else + { + AboutToStartScene = false; + } + + if (e == PlayModeStateChange.EnteredPlayMode) + { + IsPlaying = true; + } + + if (e == PlayModeStateChange.ExitingPlayMode) + { + IsPlaying = false; + } + }; #else EditorApplication.playmodeStateChanged += () => -#endif { // Before scene start: isPlayingOrWillChangePlaymode = false; isPlaying = false // Pressed Playback button: isPlayingOrWillChangePlaymode = true; isPlaying = false @@ -77,6 +96,7 @@ static ScenePlaybackDetector() IsPlaying = false; } }; +#endif } } }