- Home /
Unskinned meshes of the same material won't batch
I have a reactor asset in my scene that is surrounded by 24 shield emitters - the player has to damage and destroy the shield emitters to be able to shoot through them and damage the reactor.
Each shield emitter consists of 5 meshes - a plane being the shield itself, and then four smaller components that animate and rise up/down depending on whether the shield is active or not. The shield plane has one material, whereas the other 4 meshes share another.
Since each emitter has to react individually to the player firing at it, these are all individual GameObjects - basically 24 parented prefabs each containing 5 child GameObjects with MeshRenderers.
My issue is that this entire setup adds about 100 draw calls, which is around a 50% increase in total draw calls in the game. I am confused as to why dynamic batching does not work in this instance. I would have assumed it to add two draw calls - one for the batched shield planes, and one for all the batched smaller components, since those are the only two materials it uses.
I am using a regular MeshRenderer (not skinned). Am I missing something else here?
On further thought, maybe I am misreading the stats? I see 'Batches' go up by about 100 but SetPass calls stay about the same - does that imply it is indeed being dynamically batched?
Answer by ivarhill · Apr 27, 2019 at 11:52 PM
Turns out being lightmapped prevented batching from occurring. I made these meshes not use a lightmap and batching now works.
Your answer
Follow this Question
Related Questions
Optimizing large numbers of trail renderers 0 Answers
Why can't I batch some draw calls? 0 Answers
SetPass calls - important to keep this number low? 5 Answers
Draw calls on PC and Console? 0 Answers
Is there a performance benefit to using Sorting Layers for 2D objects versus Z-axis positioning? 1 Answer