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

Commit

Permalink
fix ScenePlaybackDetector.IsPlaying is still false when disable Domai…
Browse files Browse the repository at this point in the history
…n Reloading
  • Loading branch information
kyubuns committed May 10, 2021
1 parent 284d5c5 commit 9aa2c8b
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -77,6 +96,7 @@ static ScenePlaybackDetector()
IsPlaying = false;
}
};
#endif
}
}
}
Expand Down

0 comments on commit 9aa2c8b

Please sign in to comment.