Search Unity

UIEvents.IMGUIRenderOverlays GC every frame

Discussion in 'Editor & General Support' started by arvzg, Nov 30, 2018.

  1. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    619
    Hi guys, just tracking down this one profiler entry that's GCing every frame:

    upload_2018-11-30_11-38-28.png

    This is profiled on both a Win64 standalone build, but I am also seeing this entry when profiling on the Switch.

    Any advice what it could be?

    Unity 2018.2.16f1

    Thanks
     
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,456
    Are you using IMGUI in your player? Maybe to draw an FPS overlay?
    Is the CoroutineHelper a class of yours?
     
    arvzg likes this.
  3. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    619
    Ah! CoroutineHelper is one of my classes, and I do remember now that it does some IMGUI stuff - I'll take a look at it and remove that part of the code, thanks!

    Although at the moment it's not showing any of the IMGUI stuff... anyway, I'll have a look!
     
  4. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,456
    I'm guessing it's enough if it has an OnGUI method.
     
  5. Coreengage

    Coreengage

    Joined:
    Nov 25, 2020
    Posts:
    6
    Hi, I'm having the same issue. (Unity 2022.2.16f1)

    It seems like RuntimeEntryPoint.OnGUI is triggering GC it but I have no idea what it is (i searched in project but it is not a my class)
    Any advice about this?
    Thanks.

    ss_gc.png
     
  6. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,456
    Maybe it's code from a package? No clue otherwise. Deep Profiling could maybe help illuminate this.
     
    Coreengage likes this.
  7. ruudvangaal

    ruudvangaal

    Joined:
    May 15, 2017
    Posts:
    27
    BeginGUI() seems to create a bit of garbage for every OnGUI() function that is active. If RuntimeEntryPoint.OnGUI() is not doing anything, you can define it in a different class (derived from MonoBehavior) and disable that when OnGUI() is not rendering anything. Here that saves the call to GUIUtility.BeginGUI(), which is creating the garbage.