Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Editor loop why is it causing 452 ms delay?

Discussion in 'Editor & General Support' started by SunnyValleyStudio, Aug 14, 2019.

  1. SunnyValleyStudio

    SunnyValleyStudio

    Joined:
    Mar 24, 2017
    Posts:
    4
    Hi,
    I have spotted a lag issue in my game and upon investigation it appears that "Editor loop" is causing a massive delay. The delay occurs when one of the methods is called "StartBuildingPlacement()" but it appears only to have only 0.5ms delay while the Editor loop spikes in total usage intensity. The Event loop stays above 70% total usage at all times - is that good? I am new to profiling but the issue I have is that testing the game in the editor became tedious because of it. I updated the project to the latest Unity version 2019.2 but nothing has changed.
    What can I do about Event loop high time lag?

    I attach a screenshot of the profiler window.

    Thanks,
    Peter
     

    Attached Files:

  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    283
    Hi Peter,
    Profiling in the editor is not the most reliable way to get timings as they would occur for your game on your target platform, because the game running in Playmode is running in the same main thread as the editor around it is. This skewers timings across threads so that, e.g. the render thread has entirely different timings (i.e. it needs to render the editor; commands between main thread, render thread and GPU are send at different intervals than they would be outside the editor).

    The Profiler tries to mitigate the difference as much as it can without actually hiding time. One step taken to mitigate this was to not Profile any samples that are not originating from Playmode, i.e. the player loop but instead are attributed to the editor.
    If you want to see what the editor was doing in your case here, you'll need to turn on the 'Profile Editor' toggle in the Profiler window toolbar (or change the target from Playmode to Editor on 2019.3 and above).
    It might be that some script of yours has an effect on the editor, such as a custom inspector or similar. It might also be some AssetStore tool, or it could be an issue with the Editor itself. Profiling the editor would be the way to investigate which one it is and how to mitigate or fix this.
     
    Last edited: Aug 14, 2019
    SunnyValleyStudio likes this.
  3. SunnyValleyStudio

    SunnyValleyStudio

    Joined:
    Mar 24, 2017
    Posts:
    4
    Thank you for a very quick answer. You're the best! I have found out an issue by an asset "NINEVA STUDIOS Project/Hierarchy Stickies". After deleting delays are gone. Thanks to the Profile Editor I have found that there is a massive amount of calls to refresh the editor.
    Thanks again!
     
    MartinTilo likes this.
  4. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    283
    Nice!
    Glad it helped and happy to be able to help. You might want to let the developer of that asset and others know about this issue by posting a review on the Asset Store ;)
    Happy coding :)