tl;dr: Getting a bottleneck in ECS, according to profiler: “RenderMeshSystemV2” when drawing 3000 boids (made of a simple quad) on Unity 2019.4.14
Hey, new to ECS here (started a tutorial 2 days ago, still wrapping my head around it) and I am testing my own “boids stress test” project to push this system to its limits. I think I’ve got the jobs system working as expected because all the worker jobs are pretty active, and my boids algorithm is taking the least amount of time in the profiler.
That being said, the part that is taking a lot of time is “RenderMeshSystemV2”. At the time of taking this screenshot, there were 3000 boids on screen, so it is not surprising that it would struggle a bit. I was surprised that rendering was the bottleneck however. See the profiler hierarchy below:
Is this something that can be optimized at all? Or due to hitting a bottleneck in rendering, am I at the limit of what my PC is able to do? 3000 boids seems low, I was imagining being able to hit a much higher number.
This is miss leading. The reason the RenderMeshSystem is taking so long is it’s simply waiting (Job.Complete) on the previously scheduled jobs from other systems (BoidSystem) which you can clearly see in your timeline screenshot.
Your BoidSystem is extremely slow, taking 30ms+, not RenderMeshSystem.
Ah I see. Should I edit the title of this post or something?
I did see the “JobHandle.Complete” but I assumed that was Unity completing some rendering related job. If it is my boids system taking a long amount of time, why am I not able to see what part of the system is unoptimized? Even with deep profile I am not able to see any particular part of my boids system that is taking a long time. Any ideas on how to find what is taking so long?