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

Question How would I go about fixing a OnGUI.repaint bug

Discussion in 'Editor & General Support' started by aganm, Jul 12, 2021.

  1. aganm

    aganm

    Joined:
    Sep 25, 2019
    Posts:
    114
    Using Unity 2020 LTS latest version.

    I'm using an asset which has custom editor GUIs and when I try to use those GUIs, Unity 2020 LTS shows me this loading bar


    This loading bar takes about 5 seconds to finish. And every time I click inside the custom GUI, this loading bar appears. Only when I close this GUI entirely does the bug stop happening. I left details about what is happening on their discord waiting for an answer.

    How would I go about fixing such a bug myself? Does Unity have some kind of GUI debug inspector that would pinpoint the cause of this bug?
     
  2. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    It means that the window is taking a very long time to draw a single frame. Either because it is poorly optimized, your hardware is extremely low-end or there's a bug/exceptions thrown on every repaint.

    You can use the Profiler and enable editor profiling and deep profiling, start recording, then open the window. If you catch the spike in the profiler and stop it in time, you can then investigate which calls are slow which should point you to the problematic code.