Can I get a callback when scripts have finished compiling?

I was unable to find a callback for use in an editor script to let me run code when compilation has finished. It might sound a little crazy at first, but such a callback could be useful for code generation techniques.

AssetDatabase.ImportAsset can be called on a script to force compilation immediately but will return before compilation is complete.

AssetPostProcessor doesn't appear to be able to call back for scripts.

C# can't have anything like Eval().

If anyone can think of a way to accomplish this please answer.

("YO DAWG I HEARD YOU LIKE EDITOR SCRIPTS...")

Use the attribute DidReloadScripts like this:

[UnityEditor.Callbacks.DidReloadScripts]
private static void OnScriptsReloaded() {
    // do something
}

Note that this does not run in batch mode when doing a build with the -quit flag even if scripts are reloaded.

public class YourEditorWindow : EditorWindow
{
static YourEditorWindow instance = null;

     [MenuItem("YourMenu")]
      void Init()
      {
          instance= GetWindow(typeof(YourEditorWindow )) as YourEditorWindow ;
          instance.Show();
      }
      void OnGUI()
      {
          if (instance==null)
          {
              Init();
              return;
          }
     }

if script is recompiled all the static value is null and than you reopen your editorwindow

what would be the implementation to call just before the code starts recompiling? It would be through static methods and attributes, like Guavaman’s response:

 [UnityEditor.Callbacks.DidReloadScripts]
 private static void OnScriptsReloaded() {
     // do something
 }

There isn't a callback, but you can poll on this variable: EditorApplication.isCompiling