Search Unity

"SceneCulling" large CPU latency during multiple UI element position update

Discussion in 'UGUI & TextMesh Pro' started by Init33, Jun 16, 2018.

  1. Init33

    Init33

    Joined:
    Aug 30, 2017
    Posts:
    67
    I am having an issue that's causing significant latency spikes in my CPU usage and I'm not sure why.

    What caused the issue:
    I have many (20-30) canvases present on the screen at once that update their panel child anchor position every Update cycle (shouldn't be very CPU expensive). These canvases each have a panel child with a text and image child. The idea is to have a little sprite image that follows the gameobject around on the screen with some information. So far so good.

    However upon implementing this I am getting huge CPU usage due to "SceneCulling" in the profiler. I am not sure what this is or how it relates to my UI elements. I have tried with my main camera occlusion culling both on and off but still laggy.

    Below is a snapshot of my profiler.

    Any idea what is causing the issue here?



     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    It seems you profiled the game running in the editor. I recommend to repeat the test and profile a build on the target platform instead. The editor often has significantly different performance and memory characteristics than a build and perhaps these spikes only exist in the editor.

    Here is also an interesting talk why it's important to profile a build rather than the game running in the editor...
     
    sj631 likes this.
  3. Init33

    Init33

    Joined:
    Aug 30, 2017
    Posts:
    67
    Thanks Peter, I did a build of the game and can confirm that the latency issues are no longer present. Might have just been the editor.
     
    Peter77 likes this.