- Home /
Why isn't dynamic batching working?
I have a scene with a Mesh that has 183 vertices (from the Unity statistics window) and when I duplicate it, it creates another drawcall. They all use the same material and nothing is being instanced. Is there anything else I need to do to get dynamic batching to work? I thought the only conditions were the mesh needed < 300 vertices and they shared the same material.
I think it's something with my mesh.. recreating it from scratch and i'm getting it to batch again. Oh well..
Answer by pyro · Dec 03, 2010 at 02:09 PM
Just to close this here's some other things to check for why dynamic batching isn't working:
1) Check the UV's on the model, if something has 60 vertices and somehow 300+ UV's mapped it's probably not going to batch
2) Check how they're layered, if the two objects that share the same material have another object with a separate material layered between them, it has to break it up into another draw call
3) Check if a material is instanced, if so it's not going to dynamically batch. (If you modify a material directly through script it makes it into an instance)
Just wanted to say thanks about the info about seperate objects on different layers. This just solved a big problem I was having and haven't seen this info anywhere else, thanks!
Answer by laurent · Mar 18, 2011 at 11:14 AM
2) the batch gets split only if the batch uses alpha transparency
Answer by nerophon · Sep 20, 2012 at 03:31 PM
How to Make Objects Dynamically Batch in Unity
they must share the same material
the material must not be instanced (check material name in debug inspector)
batching is applied only to meshes containing less than approx 900 vertex attributes in total (check mesh properties for some idea about this; for starters turn off normals & tangents to reduce it)
the textures must not include alpha
scale breaks batching
lightmaps break batching
multipass shaders break batching
layering other objects in between objects trying to batch can break batching
if you are instantiating the object in code, you may be instancing the material; try re-applying the material asset through .sharedMaterial
even within single-pass shaders, some can batch higher vertex attribute counts than others... in particular if you use a shader that colors vertices you’ll be adding attributes
Your answer
Follow this Question
Related Questions
Batching problem when using multiple materials in one model 1 Answer
Dynamic Batching + VertexLit + PointLight = 1 Draw call? 1 Answer
Is it possible to utilize iphone dynamic batching with "traditional" animated sprite techniques? 1 Answer
Android / iPhone deployment.. 2 Answers
Dynamic batching of animated models 0 Answers