- Home /
Batching problem. (objects with shared material are not being batched)
I am working with unity3d pro 4.0.1. (iOS pro version ) . I am currently facing many performance issues for iOS (may be due to lack of graphics optimizations and CPU optimizations).
I have created some low resolution objects (into MAYA) and characters (maximum 1.3k vertices for each) which share a common material . I have used an common "ATLAS TEXTURE" for each object so that I can share a material between maximum number of objects as possible. It worked really great to minimize my DRAW-CALLS.
But my scene need to display many copies of a particular objects (or coins) (may be about 40-60). System issues one draw-call for each coin. Here, I need batching for the coins. I have used "static batching" by making coin's prefab static. but when I run my game scene with 10 coins on screen the number "SAVED BY BATCHING" under "STATS" showing me zero ( 0 ) means no object is being batched by the system .
Is it possible that no any objects or their copies in same scene sharing same material don't be batched ??
I have also some objects with animations . Some times they are being batched and sometimes not . What may be the issue ?
Does machine determine by its own way and decide which objects to be batched ??
Even a little help or clue will be highly appreciated :-) .
Answer by ankush_Kushwaha · Jan 12, 2014 at 07:57 AM
There is some verts limit for batching . If an object will comprise of more than that vert limit than that object won't be batched by Unity. Just try to reduce your verts per object you will be getting your object batched. Try to reduce your coin's verts it will definitely be batched. I dont know the actual limit but you can do google to get the limits.
Answer by robertbu · Feb 20, 2013 at 05:16 AM
The problem may be mesh complexity. If the number of "vertex attributes" exceeds a limit, thy will not be batched. From the reference: "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 and if your shader is using Vertex Position, Normal, UV0, UV1 and Tangent, then only 180 verts."
Your can read more here.
In addition, if you change any material properties at runtime, then you get a new material instance and they will not batch.
Your answer
Follow this Question
Related Questions
Batching Nightmare, What affects dynamic Batching!? 0 Answers
Batching on moving objects[Solved] 1 Answer
How to make common material for CPU optimization? 1 Answer
Understanding draw calls 0 Answers
Why is the CPU usage so high? 1 Answer