- Home /
Question by
Ravart · May 22, 2017 at 01:28 AM ·
editorexecuteineditmode
Unity Editor, detect Save or Rebuild Event
Hi everyone!
My editor script requires a Refresh after the user saves or scripts are compiled. Update works, but it's not perfect, since it triggers on many occasions.
Is there a methode or event to catch "Saving the Scene" and or "Rebuilding Scripts"?
Thanks
Comment
You can use the script reload function like this.
[UnityEditor.Callbacks.DidReloadScripts]
private static void OnScriptsReloaded()
{
// do whatever you need to do here.
}
by the way.... I found this is a 5-second google search...
Answer by Ravart · May 22, 2017 at 02:23 PM
static void OnScriptsReloaded() is static, is there a non-static approach?
RobAnthem
Probably I could solve it with something like that:
public delegate void Methode();
public static event Methode Update;
public static void Refresh(){
if (Update != null){
Update();
}
}
But is there an non-static approach (for simplicity) What's the event for saving?
Sincerely