Search Unity

  1. Want to see 2020.1b in action? Sign up for our Beta 2020.1 Overview Webinar on April 20th for a live presentation from our evangelists and a Q&A session with guests from R&D.
    Dismiss Notice
  2. Interested in giving us feedback? Join our online research interviews on a broad range of topics and share your insights with us.
    Dismiss Notice
  3. We're hosting a webinar for the new Input System where you'll be able to get in touch with the devs. Sign up now and share your questions with us in preparation for the session on April 15.
    Dismiss Notice

Bug EditorApplication.isCompiling is always false

Discussion in '2019.3 Beta' started by RunninglVlan, Oct 31, 2019.

  1. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    25
    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:
    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEditor.Callbacks;
    3. using UnityEngine;
    4.  
    5. [InitializeOnLoad]
    6. public class Callbacks {
    7.  
    8.     private static bool startedCompiling = false;
    9.  
    10.     static Callbacks() {
    11.         EditorApplication.update -= OnUpdate;
    12.         EditorApplication.update += OnUpdate;
    13.     }
    14.  
    15.     private static void OnUpdate() {
    16.         if (EditorApplication.isCompiling && !startedCompiling) {
    17.             Debug.Log("Compilation started");
    18.             startedCompiling = true;
    19.         }
    20.     }
    21.  
    22.     [DidReloadScripts]
    23.     static void OnScriptsReloaded() {
    24.         Debug.Log("Compilation finished");
    25.         startedCompiling = false;
    26.     }
    27. }
    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?
     
    Last edited: Nov 1, 2019
    kkacperz and nicmarxp like this.
  2. nicmarxp

    nicmarxp

    Joined:
    Dec 3, 2017
    Posts:
    260
    Aha.. I guess it's 2019.3 beta, or is it out yet?

    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.. :p
     
    WildStyle69 likes this.
  3. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    443
  4. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    25
    @lukaszunity, thanks a lot.
    I started using compilationStarted/Finished. I also reported the bug about isCompiling. It's in FogBugz for now - Case 1196623.
     
    Last edited: Nov 8, 2019
  5. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    25
unityunity