Hello, noticed a bug that isn’t present in 2019.2.11f1. I had an Editor script that logged Compilation Start and End, where Start depended on EditorApplication.isCompiling. In 2019.3.0b8 isCompiling is always false, presumably because of functionality which prevents doing anything in the Editor during Compilation. I guess it stops all running threads or something, and isCompiling would probably return true, but EditorApplication.update isn’t triggered.
Here’s the code:
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
[InitializeOnLoad]
public class Callbacks {
private static bool startedCompiling = false;
static Callbacks() {
EditorApplication.update -= OnUpdate;
EditorApplication.update += OnUpdate;
}
private static void OnUpdate() {
if (EditorApplication.isCompiling && !startedCompiling) {
Debug.Log("Compilation started");
startedCompiling = true;
}
}
[DidReloadScripts]
static void OnScriptsReloaded() {
Debug.Log("Compilation finished");
startedCompiling = false;
}
}
I’ve nothing against functionality which prevents doing anything in the Editor during Compilation, and maybe I wouldn’t event write this Script if it was present before, but now I need it to compare compilation times when doing project structure optimizations.
P.S.: I also noticed that InitializeOnLoad is called after compilation. Didn’t know about it before. Maybe documentation needs to be updated as there is nothing said about compilation end?
Actually it would be suuuuch a big improvement if the editor wasn’t actually locked when compiling. Usually I could have adjusted some transform or do stuff while it’s compiling/reloading that’s not related to any scripts.
And like if a script changed on the same object I’m working on, I’d be fine if it would reset or so.
Is that technically impossible? The waiting time between pressing save and when you can go into play mode takes a looot of valuable dev time.
On a sidenote, when I stand up and work on my stand-up desk, i try to jump around and do stuff while it’s compiling… so in some way I guess it’s good…
@lukaszunity , thanks a lot.
I started using compilationStarted/Finished. I also reported the bug about isCompiling. It’s in FogBugz for now - Case 1196623.
only work for the specific compiling time in the pipeline (2.2s on my project), not the whole time waiting for unity to become responsive again (7.7s in my project).
A fix to that, or another way to measure total unresponsive time is highly useful to keep track of total iteration time. Specially in AA projects.
What to do in batch mode. If I am setting Symbols like this?
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android,"DefineFive");
#if DefineOne
Debug.Log("One is defined");
#elif DefineFive
Debug.Log("Five is defined");
#endif
My Issue is that the log “Five is defined” is not being printed on Editor log in first attempt in batchmode. It is being printed if I run the command again. What callback I should use for this?
I am using this command.