How can I detect PlayModeState changes even when my Editor Window is closed?

I have an editor window in which I’m doing certain actions when play mode is entered. However, when this editor window closes, the playModeStateChanged event is no longer caught since the editor window instance doesn’t exist anymore. Is there any way I can continue to catch these events, even when the editor window is closed?

Yes. Try hooking that event up in a ScriptableSingleton<> instance. The window’s class can then access the singleton to get the current state (or just use EditorApplication properties).

1 Like

Thank you, this is exactly what I was looking for!