Open oxysoft opened 6 years ago
Something that can be mapped to a shortcut. Here is how I implemented in Unity using a short editor script..
public static class ReplayGameMenuItem { private static bool isDisabled; [MenuItem("Tools/Re-play Game _F5")] public static void MenuItem() { if (isDisabled) return; if (EditorApplication.isPlaying) { EditorApplication.isPlaying = false; EditorApplication.playModeStateChanged += StateChanged; } else { EditorApplication.isPlaying = true; } isDisabled = true; } private static void StateChanged(PlayModeStateChange change) { if (change == PlayModeStateChange.EnteredEditMode) { EditorApplication.isPlaying = true; isDisabled = false; EditorApplication.playModeStateChanged -= StateChanged; } }
}
So, if we are in Play mode, calling this action stops Play, waits till entering EditMode and Plays again?
Something that can be mapped to a shortcut. Here is how I implemented in Unity using a short editor script..
}