If you need to know when the unity editor is changing play mode states you can hook into the EditorApplication.playmodeStateChanged callback.
Related posts
Add comment
Cancel reply to comment