Skip to content

Commit

Permalink
feat: allow Play mode options
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpach committed Mar 29, 2020
1 parent 1ffa392 commit f9afb64
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions Assets/Mirror/Editor/EnterPlayModeSettingsCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ namespace Mirror
public class EnterPlayModeSettingsCheck : MonoBehaviour
{
[InitializeOnLoadMethod]
static void OnInitializeOnLoad()
public static void OnInitializeOnLoad()
{
#if UNITY_2019_3_OR_NEWER
// We can't support experimental "Enter Play Mode Options" mode
// Check immediately on load, and before entering play mode, and warn the user
CheckPlayModeOptions();
#endif

// Hook this event to see if we have a good weave every time
// user attempts to enter play mode or tries to do a build
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
Expand All @@ -30,12 +24,6 @@ static void OnPlayModeStateChanged(PlayModeStateChange state)
if (state == PlayModeStateChange.ExitingEditMode)
{
CheckSuccessfulWeave();

#if UNITY_2019_3_OR_NEWER
// We can't support experimental "Enter Play Mode Options" mode
// Check and prevent entering play mode if enabled
CheckPlayModeOptions();
#endif
}
}

Expand All @@ -58,17 +46,5 @@ static void CheckSuccessfulWeave()
}
}
}

#if UNITY_2019_3_OR_NEWER
static void CheckPlayModeOptions()
{
// enabling the checkbox is enough. it controls all the other settings.
if (EditorSettings.enterPlayModeOptionsEnabled)
{
Debug.LogError("Enter Play Mode Options are not supported by Mirror. Please disable 'ProjectSettings -> Editor -> Enter Play Mode Settings (Experimental)'.");
EditorApplication.isPlaying = false;
}
}
#endif
}
}

0 comments on commit f9afb64

Please sign in to comment.