If I have 200 objects, each identical, with their GPU Instancing enabled shader. Unity won’t batch/instance them all in one go. Instead, it chooses to render random unique objects in between multiple small batches of this object. Why is this?
In the frame debugger, Unity will render 1 - 7 identical objects that are furthest away from the camera, then render something else in the scene, a single instance of a random object, before batching/instancing another 1 - 7 of my identical object again.
The reason for a new batch in the frame debugger that is given, is something like “Objects have different materials” or “Non-instanced properties set for instanced shader”, which makes sense, because of coarse this batch of 5 - 7 objects have a different material than the unique object that Unity chose to draw in between batches of the identical object.
But my question is, WHY does Unity choose to render/draw something unique in between groups of 5 - 7 identical objects, when there are 200 of these in total?
The highlighted “Draw Mesh” call, and the first “Draw Mesh” call under the “RenderLoop.Draw” are both drawing identical objects. The “Draw Mesh” call in between them is a unique, random object.
This problem seems to be much worse with a sprite shader, than any other. I am trying to use the default sprite shader with a sprite renderer, which does allow for GPU instancing, although, it doesn’t seem to want to actually do it, because the whole problem seems to be non existent when a more standard shader is used?