Trying to get dynamic batching to work without having to go under 300 verts:
Using Unity 5.3.1f
Already checked these rules:
- They share the same material
- Materials not instanced
- Unity shows the vertex count being under 900
- Using most simple shader (only a color is output)
- Forward render mode
- No Transparency or alpha
- No light or shadows and switched off all the settings for receiving shadows etc.
- Scaling is uniform (1,1,1)
- No layering of objects in the view
- Not instancing object from code
- No lightmaps
Both in scene when rendered with material applied (simple shader), and viewing imported mesh in the project view we see the object having:
789 verts and 472tris
The mesh in question has vertex color and a uv applied. Testing has proven that removing either of these reduces the number of verts counted by Unity (to 238 verts) , we assume these are not counted additionally to the 789 verts as they are already included.
We would like to be able to batch moving objects with a low polycount with vertex color and a uv applied, dynamic batching is behaving very unpredictable up and till now. If anyone has an idea why this would not work we would be very grateful…
The Documentation refered to in the question seems to be wonky:
batching is applied only to meshes
containing less than 900 vertex
attributes in total.
even though Unity displays the amount of vertex attributes directly in the editor we never got it to batch with anything over 300 vertex attributes.
This line does hint that the actual limit might change:
“Please note: attribute count limit might be changed in future”
Either Unity does not account for certain attributes when counting the vertex attributes inside the editor or (as of the time of speaking) the documentation is wrong.
Testing showed us that dynamic batching has too much overhead for what we need.
We now batch all meshes manually and update the combined mesh when something changes which is not all to often.
For this we use the combineMeshes method.
Batching dynamic objects has certain overhead per vertex, so batching is applied only to meshes containing less than 900 vertex attributes in total.
If your shader is using Vertex Position, Normal and single UV, then you can batch up to 300 verts; whereas if your shader is using Vertex Position, Normal, UV0, UV1 and Tangent, then only 180 verts.
dynamic batching vertex limit count = 900 / Shader vertex attribute count
so, if you want to use dynamic batching, please check the shader used.
In case someone bumps into this concern.
Just to make it simple, try to make sure your model is below 300 vertices.
Take note we are talking about Unity Vertex Count not the 3D modelling software vertex count.