Search Unity

Editor freeze after compile

Discussion in 'Editor & General Support' started by diekeure, Aug 16, 2017.

  1. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    Hello,

    We have some weird behavior with our game in the editor, In Unity 5.5.3f1 64bit (although we had this with all previous versions too).

    I'm pretty sure it's something that we do wrong, since I don't have this behavior in other games. So something causes what I'm about to describe, and I hope someone can give me a hint in the right direction.

    When compilation is done (after changing a script), the editor freezes several (+/- 15) seconds, see:



    Notice that the last file event in the image is for the Unity.IvyParser.config file at 22:04:18 and then suddenly the events stop and then resume at 22:04:33, that's the period when Unity is inactive.

    If I then right click anywhere in the editor or try to open a menu item, there is an additional wait of about 10 seconds:



    This time there are events in process monitor, there is network communication, however, the editor is not responsive in the meantime.

    As said, this probably is caused by some script/configuration in our project since we don't have this in other projects. This is quite a large project (a few GB's), while the others are only in the MB's, so maybe the project is just becoming too big?

    I tried removing all possible editor scripts that we have, but that didn't help unfortunately. Kicking out most of the assets didn't help either.

    Anyone who can give me an idea what to try next?

    Many thanks!
     
    Last edited: Aug 17, 2017
  2. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    Another reason why I'm quite sure it's our code: when there is an compilation error (and the code can't be loaded), Unity becomes very responsive again.

    In the editor log it reads: "- Completed reload, in 15.110 seconds", which matches the 15 seconds of inactivity in the process monitor.

    I'll be posting ideas and progress here in case it helps anyone. If you can help me, let me know!
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,433
  4. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    No log messages whatsoever (we are warning free :) )

    I'll be trying to move code around today.
     
  5. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    I played a bit more with the process monitor, I've added the processes that are spawned by unity in my filter:



    And then the log looks like this:



    So it seems that Unity is waiting on visual studio to complete something?

    Is this something that can be avoided?
     
  6. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    I noticed that, when I have an error in the code, the first 15+ seconds freeze does not happen, but the second, 10+ freeze keeps happening.
     
  7. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    I tried adding parts of the game to a new project, to see which part would introduce the delays.
    There was no part that increased the delays by a lot,
    Now that I have some parts of the project copied over, I'm seeing the same delays, but smaller...
    Meaning they'll grow bigger if I make the project larger... would this be an issue in Unity after all?
     
  8. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    Today I tested some more on a Mac, with monodevelop. I'm seeing the same delays.

    Thus: this issue has nothing to do with anything windows related, nor visual studio.
     
  9. Simoense

    Simoense

    Joined:
    Aug 19, 2013
    Posts:
    12
    I'm working with alexvda on this project.

    I found a reddit post suggesting several changes to speed up compile times.
    https://www.reddit.com/r/Unity3D/comments/52ggh4/speeding_up_script_compile_times/
    • incremental compiler
    • turning off Windows Search service
    • disabling our Version Control plugin in Visual Studio (Perforce in our case)
    The incremental compiler seems to have a small effect on the initial compile time, maybe cutting it down with 2 seconds.
    The other suggestion don't seem to have any effect, leaving the freeze after compilation unchanged.
     
  10. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    Happy to report that the wait times in 2017.1.2f1 seem to be fixed. Of course there's still a compile time, but after that there are no more unexpected waits...