From 9aa2c8be29bb1774c34f9a8ba98f4e586b645e96 Mon Sep 17 00:00:00 2001 From: kyubuns Date: Mon, 10 May 2021 18:35:49 +0900 Subject: [PATCH] fix ScenePlaybackDetector.IsPlaying is still false when disable Domain Reloading --- .../ScenePlaybackDetector.cs | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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 } } }