Wondering what this is so I can fix it (happens seemingly randomly for a frame):
[I am not using occlusion culling]
Wondering what this is so I can fix it (happens seemingly randomly for a frame):
[I am not using occlusion culling]
Bump - just looking for a Unity person who can tell me what is happening within “PrepareSceneNodes”
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.
I’m also seeing this in the 2018.4 LTS. Currently with standalone player loaded
I got it too, in 2018 LTS. Was there a bug reported on this?
Got this too in 2018.4.2f1. Takes 5ms on the scene with lots of disabled game objects on Xiaomi Mi Pad 4.
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?
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.
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.