How do I get my delegate installed if a script exists in Assets period?
I found I can add a delegate to EditorAppllication.playmodeStateChanged
and it’s clear I can check for transitioning going into play like this
void OnPlaymodeStateChange()
{
if (!EditorApplication.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode)
{
DoStuffJustBeforePlaying();
}
}
What’s not clear is how to get that delegate installed in the editor. For example I currently have it in an EditorWindow. But an EdtiorWindow only gets instantiated of someone picks it from the menus. I could put it on a MonoBehavior but would only get executed if the user adds that behavior to a GameObject.
I need my delegate installed period. If the user has added my script to their assets folder I need my delegate to do some work when the user runs.