Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Profiler.CollectGlobalStats high fps problem

Discussion in 'General Discussion' started by RyanWorkAcc, Feb 4, 2019.

  1. RyanWorkAcc

    RyanWorkAcc

    Joined:
    Nov 5, 2018
    Posts:
    3
    Hi, I'm a beginner in unity,

    my fps isn't great for my game I'm working on. I went to profiler a few times and somewhere along the line I got a high CPU usage in others (Profiler.CollectGlobalStats)

    Please help.

    Regards,

    Ryan
     

    Attached Files:

  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    Hi Ryan,

    Which version of Unity are you using?
    What you are seeing under Profiler.CollectGlobalStats is overhead due to profiling and will not affect your final game.
    In 2018.2 or newer you can close the Memory Profiler Module by clicking the x next to the legend of the memory chart in order to avoid the overhead in Profiler.CollectMemoryAllocationStats shown here.

    That said, you might want to look at how you allocate memory, both in terms of GC.Alloc in your scrips and your usage of memory for assets because that much overhead hints at there being a lot going on.

    However, from this frame alone, I can't tell you why your overall performance is suffering.

    The only other thing I can see from the screenshot is that you are using IMGUI in your game (the GUI.Repaint sample is giving that away). That is not recommended. It is slow and as demonstrated in the screenshot allocates managed memory (GC.Alloc column in the Profiler). It's recommended to use uGUI and I'd even use that for debug ui.