Search Unity

[Profiler] PrepareSceneNodes

Discussion in 'Editor & General Support' started by threeguysgamestudio, Feb 1, 2019.

  1. threeguysgamestudio

    threeguysgamestudio

    Joined:
    Dec 1, 2017
    Posts:
    25
    Wondering what this is so I can fix it (happens seemingly randomly for a frame):

    [I am not using occlusion culling]

     
  2. threeguysgamestudio

    threeguysgamestudio

    Joined:
    Dec 1, 2017
    Posts:
    25
    Bump - just looking for a Unity person who can tell me what is happening within "PrepareSceneNodes"
     
  3. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Prepare scene nodes is when we construct the renderable objects from what passes culling. This seems very long given that the other events are not long at all. Can you check in the standalone player to see if this is the same? Would appreciate a bug on this as it doesn't look like you have a lot of stuff being rendered.
     
  4. LeagueOfMonkeys

    LeagueOfMonkeys

    Joined:
    Aug 13, 2012
    Posts:
    33
    I'm also seeing this in the 2018.4 LTS. Currently with standalone player loaded
     
  5. skirners1

    skirners1

    Joined:
    Sep 4, 2014
    Posts:
    9
    I got it too, in 2018 LTS. Was there a bug reported on this?
     
  6. MrGuardianX

    MrGuardianX

    Joined:
    Sep 29, 2014
    Posts:
    58
    Got this too in 2018.4.2f1. Takes 5ms on the scene with lots of disabled game objects on Xiaomi Mi Pad 4.
     
  7. Domas_L

    Domas_L

    Unity Technologies

    Joined:
    Nov 27, 2018
    Posts:
    111
    I couldn't find any issues reported about "PrepareSceneNodes". If it is still reproducible with the latest releases, could someone please submit a bug report with a minimal reproduction project for this issue and reply in here with the issue ID?
     
  8. AnSstuff

    AnSstuff

    Joined:
    Mar 24, 2018
    Posts:
    4
    I think it's the same bug as the infamous Occlusion culling CPU spike in profiler which actually has nothing to do with culling.

    The spikes randomly appear either at Camera.FireOnPreCull, or at CullSendEvents, or at PrepareSceneNodes, or at CullResults.CreateSharedRendererScene, or at CullPerObjectLights, or at UpdateRendererBoundingVolumes, etc. Basically, at any rendering-related function of the main thread that waits for workers to finish their job. Often people notice it at WaitForJobGroup. The problem is most definitely related to jobs/threading and not culling. But Profiler obfuscates the problem by pointing to Main thread function that is waiting for the problematic job to finish - this can be seen in Timeline mode.

    worker does not execute.png

    For some reason at these spike-frames one of many small jobs suddenly takes 20-80ms instead of usual 0.005ms. So main thread stalls for 20-80ms instead of doing anything useful. See attached screenshot - here I catched the rarest moment when scheduled job couldn't even start for 79ms - it's like OS was not giving the thread any time slices for the span of 80ms, only allowing Scripting threads to run. Maybe it's because of lower priority of Worker threads? As other people noted, the spikes disappear when running on single core, so it's not that CPU just cannot handle the scene (test scene is very lightweight, no culling/no lights/etc).

    Fortunately, I'm only experiencing these spikes when profiling (either in Editor or by attaching dev build). Without profiler, dev builds run smoothly.
    Still, this issue is very bothersome when testing in Editor.
     
    Deleted User, WindyRyou and jagifford like this.