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.
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
}