Skip to content

Instantly share code, notes, and snippets.

@leventeren
Created December 22, 2023 09:11
Show Gist options
  • Save leventeren/d1ef7d3f3d4b755ed9b0c28ce4bd8b2e to your computer and use it in GitHub Desktop.
Save leventeren/d1ef7d3f3d4b755ed9b0c28ce4bd8b2e to your computer and use it in GitHub Desktop.
using UnityEditor;
namespace EditorBehaviourTest
{
[InitializeOnLoad]
public static class EditorBehaviour
{
static EditorBehaviour()
{
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
}
private static void OnPlayModeStateChanged(PlayModeStateChange playModeStateChange)
{
if (playModeStateChange == PlayModeStateChange.EnteredPlayMode)
{
//entered play mode
}
else if (playModeStateChange == PlayModeStateChange.EnteredEditMode)
{
//entered edit mode
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment