Search Unity

Editor loop at 2000 miliseconds when opening profiler

Discussion in 'Editor & General Support' started by Tomer-Barkan, Feb 11, 2021.

  1. Tomer-Barkan

    Tomer-Barkan

    Joined:
    Jul 31, 2012
    Posts:
    150
    I have a game that runs fine at 50-60 FPS in the editor, however as soon as I open the profiler window it slows down to a crawl of less than 1 FPS, and in the profiler all I can see is the editor loop taking up 2000 miliseconds.

    Moreover, if I leave it running for a few frames, then even after exiting play mode the entire editor remains super slow and hanging, less than 1 fps, as it was when the game was running. It will remain like that as long as the profiler window is open. If I close the profiler window, or even if I clear it, it's all back to normal.

    Any ideas? The only way I can use the profiler is with a debug build, and this is slowing me down considerably.
     
    wlwl2 likes this.
  2. Madgvox

    Madgvox

    Joined:
    Apr 13, 2014
    Posts:
    1,317
    Make sure you don't have "deep profiling" or "profile editor" on.
     
  3. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    Hi there :)
    which unity version are you using? Which Profiler Modules are active (have a chart) and which one is selected and which view is it showing (e.g. Timeline/Hierarchy)? Are you profiling Playmode or Editor and is deep profiling on?
     
  4. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    Oh and to what max amount of frames to show in the charts did you set the profiler settings?
     
  5. Tomer-Barkan

    Tomer-Barkan

    Joined:
    Jul 31, 2012
    Posts:
    150
    Hey. Deep profiling is off, all modules except GPU and UI, CPU is selected in Hierarchy mode. I'm profiling Playmode. Max frames is at 300.

    Now an interesting update. I tried disabling all the modules except CPU and then activating one by one to find the culprit. It worked in the sense that disabling all but CPU solved the problem, however when I activated them all one by one - the problem didn't return.

    So for now it seems to have been fixed (I've been suffering from this for many months now, so yey!), but I have no idea what caused it.
     
    Last edited: Feb 12, 2021
  6. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    Weird... Glad that it's solved now but not a clue what could have caused it. Please let me know if it returns. There might be a bug in there somewhere... And if that's the case, we would want to know about it and fix it :)
     
  7. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    Anyways, disabling charts means not Recording Data for them which means they won't have as big an impact on your intrusion cost (profiling overhead) and e.g. detailed audio and the UI profiler modules can have quite a cost to them. It's mostly caught in the CPU Profiler data if that cost is on the recording side of things, at the very end of the frame under the global stats reporting for Profiler :)

    So you can use that to troubleshoot and narrow it down if it happens again, and then report a bug on it :)
     
  8. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    Recording I editor mode and specially deep profiling kinda recursively profiles the profiler window which is where the standalone Profiler can come in handy as that's running in a separate process.
     
  9. Tomer-Barkan

    Tomer-Barkan

    Joined:
    Jul 31, 2012
    Posts:
    150
    Thanks for the tips. I'll let you know if it ever happens again. It's very strange because it was happening to me for months every time I tried profiling playmode instead of an external build, and then disabling and enabling all the modules solves it.

    I've restarted Unity, even upgraded to a newer version, cleared the profiler of course - and none of these solved the problems. I believe I even deleted the Library folder once. So it's surprising that a simple turn the modules off then on did solve it.
     
  10. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    It might be some view state serialized to the layout file so maybe a layout reset would've achieved the same?
     
  11. Waz

    Waz

    Joined:
    May 1, 2010
    Posts:
    287
    One way this happens for me is if I have a non-empty search/filter in the Project window. Presumably it's running that search every frame or something.
     
    nubdev likes this.