Search Unity

Question Profiler shows UGUI rendering taking long time on Semaphore.WaitForSignal

Discussion in 'Editor & General Support' started by hrkm, Mar 19, 2023.

  1. hrkm

    hrkm

    Joined:
    Oct 21, 2013
    Posts:
    13
    Is anyone else familiar with this and is this an actual profiling issue or not?

    I'm trying to understand why my dragging logic is slow (aka noticeable delay of the object being dragged with a finger on physical device), but what I found is that there's a lot of waiting in the given frame - while it's not processing, it's also not rendering the frame because it waits for something to finish, but I don't know what. How to further uncover what the RenderOverlays call is waiting for?

    And I don't see any of my code being an issue there, as UpdateBehaviors takes 5.7ms in total, which seems to be short enough for the frame to render without issues, right?
     

    Attached Files:

  2. hrkm

    hrkm

    Joined:
    Oct 21, 2013
    Posts:
    13
    Here is jobs overview, it looks like BatchDeleteObjects is having that semaphore call, but it's also pretty busy in the other 4 workers for rendering too.
     

    Attached Files:

  3. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,448
    Hi,
    Have you tried turning on the Flow Events in the Profiler Timeline? That might clarify what work on the threads the main and render thread are working on.

    If you're asking if this is going to be a performance issue in the build, I'd say that yes, very likely it will be.

    While it might not be your code that's executing here, it is your UI setup that takes the time. It looks like there might be multiple UI canvases or overlays that need to update so maybe some of that setup can be optimized? Maybe some UI parts can be turned off during the drag and drop? It's hard to tell from the outside and will likely need some experimentation from you.