In the OnGUI way I can simply check the EditorApplication.isCompiling and set the GUI.enable before draw the Button.
But in the UIElements way, I have no idea except use a timer to repeat check the ‘EditorApplication.isCompiling’.
Is there a good way to do this?
There are compilationStarted and compilationFinished events in the CompilationPipeline class, inside callbacks for these events you could simply do this: button.SetEnabled(!EditorApplication.isCompiling)
1 Like