MyMethod gets called only once, right before entering play mode.
I want it to be called when pause/stop play mode is triggered as long as my method is subscribed. But it seems like entering playmode, for some reason, removes MyMethod from subscription?
Script that has MyMethod is not a MonoBehaviour, it is a static class. Nothing in my project uses EditorApplication.playmodeStateChanged other than mentioned line of code.
I have the same problem, it will get called when it changes from “not playing” to “playing”, but never the other way round. I guess it maybe has something to do with the editor clearing the managed space when entering playmode, thus effectively removing the instances of the playmode state changed handlers, so they are destroyed and never to be seen again.
That’s how I solved it.
Putting [InitializeOnLoad] over the script makes the subscriptions last through playmode.
Though I had to spend quite some time researching to find that solution. Unity Formus or Answers never provide any support for me.