Skip to content
This repository was archived by the owner on Feb 16, 2024. It is now read-only.

Commit 9aa2c8b

Browse files
committed
fix ScenePlaybackDetector.IsPlaying is still false when disable Domain Reloading
1 parent 284d5c5 commit 9aa2c8b

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,28 @@ static ScenePlaybackDetector()
5454
{
5555
#if UNITY_2017_2_OR_NEWER
5656
EditorApplication.playModeStateChanged += e =>
57+
{
58+
if (e == PlayModeStateChange.ExitingEditMode)
59+
{
60+
AboutToStartScene = true;
61+
}
62+
else
63+
{
64+
AboutToStartScene = false;
65+
}
66+
67+
if (e == PlayModeStateChange.EnteredPlayMode)
68+
{
69+
IsPlaying = true;
70+
}
71+
72+
if (e == PlayModeStateChange.ExitingPlayMode)
73+
{
74+
IsPlaying = false;
75+
}
76+
};
5777
#else
5878
EditorApplication.playmodeStateChanged += () =>
59-
#endif
6079
{
6180
// Before scene start: isPlayingOrWillChangePlaymode = false; isPlaying = false
6281
// Pressed Playback button: isPlayingOrWillChangePlaymode = true; isPlaying = false
@@ -77,6 +96,7 @@ static ScenePlaybackDetector()
7796
IsPlaying = false;
7897
}
7998
};
99+
#endif
80100
}
81101
}
82102
}

0 commit comments

Comments
 (0)