I have a game where I use URP and a hybrid DOTS approach - most things are handled in the regular way but if there’s a lot of them I use the DOTS stack.
Since it’s a city builder I spawn citizens using DOTS - a very simple 10-ish vertice model with a URP simple lit material, GPU instancing enabled, entirely spawned as an entity so rendered using the hybrid renderer (latest, v2).
The problem is, as soon as I spawn even a single one I suddenly gain like 3ms of CPU time from URP.
Here’s the profiler screenshot before I spawn entities:
And here’s after:
When I zoom in to the part that gained 3ms it seems that most of it is spent on culling? I tried turning off the model dynamic culling but that doesn’t fix it.
I’m pretty sure this problem came at some point after I started the project and wasn’t there from the start - perhaps a setting I overlooked or a quirk in a URP update?
Anyway, if anyone has any idea what might be causing this I’d be really grateful!
Thanks, turning leak detection back off fixed some lag spikes I was having - but still, with burst enabled, safety checks off and leak detection off the issue persists, even in build
Here are the profiler screenshots post and pre spawning just 4 entities, it seems that after enabling leak detection the issue is Semaphore.WaitForSignal
I see two things. One is that culling is taking a half a millisecond longer. But you haven’t fully expanded the main thread so it is hard to see what is different. I would expect the culling to be a little longer due to BRG scheduling, but a half millisecond is surprisingly long.
The bigger issue however is your GPU sync bottleneck. Either those meshes are really expensive or something else is causing your GPU to suffer, because there’s a huge spike waiting on the graphics thread. At the end of that Semaphore.WaitForSignal, there is a little yellow vertical bar. What does that bar say?
The blue is ScriptableRuntimeReflectionSystemWrapper.Internal_ScriptableRuntimeReflectionSystemWrapper_TickRealtimeProbes(), the rest are Gfx.EndAsyncJobFrame, updateScene.Invoke, ReflectionProbes.Update, WaitForRenderJobs and TextRendering.CollectGarbage
As far as I know I don’t use reflection probes, maybe only from the Skybox? I disabled all environmental reflection in lighting settings and it didn’t fix it though
Huh. That wasn’t what I expected. But it seems you really are GPU-bound when entities are around. You don’t have any crazy meshes or crazy shaders on those entities, do you?
That’t the thing, nothing crazy at all - a super small 10 veritce mesh with URP Lit material (also tried Simple Lit, messing with material settings etc.)
Hi Xentarok and dev, sorry to necro but I have this exact same problem.
Environment : Unity 2023.1.12f1 - URP 15.0.6 - Entities graphics 1.0.14
Did you find a solution to your problem ?