- Home /
Can't figure out why 5 objects with the same material/texture are not batching..
I have an object that I imported from blender. It has 4 child objects and they all use the same material, they are very minimal in vert count and use a simple shader with one pass. I thought they would batch, but that is not the case. I read here ( http://docs.unity3d.com/Documentation/Manual/DrawCallBatching.html ) that:
-Generally, objects should be using the same transform scale. -The exception is non-uniform scaled objects; if several objects all have different non-uniform scale then they can still be batched.
The scale of my parent object is ( 6, 1.839, 3.08 ) and the 4 child objects are ( 1, 1, 1 ) in scale. Is this where my problem has occurred? How do I fix it?
Answer by Bunny83 · Nov 23, 2013 at 08:50 PM
First of all what kind of batching do you expect?
static batching? If so:
are your objects marked as static?
do you have unity pro?
If you expect them to batch dynamically, do:
your objects have a vert-count around 300?
you positioned your objects not too far apart?
For either of those, make sure you use the same material instance (like ffxz7ff mentioned). That means never touch the material property or it will create a duplicate for this object. Always use sharedMaterial(s).
Finally re-read the batching page at least two times since all that is mentioned there ;)
oops, I was confused, it is batching, but the 5 objects are taking up 3 draw calls because of the vert count. Thanks for the insight
Just incase someone is searching for this answer in the future… Another problem was what I originally expected, which is that one of the objects ( the parent object had non uniform scale ) and once I made the the scale uniform ( 1,1,1 ) dropped my draw calls down to 2.
O$$anonymous$$, I was able to trim it down to 1 draw call by separating the mesh into 7 objects in total. Now will the extra objects be creating any extra processing overhead?
Answer by ffxz7ff · Nov 23, 2013 at 07:58 PM
Just guessing here, but are you also assigning the same instantiation of the material to your objects? I don't know if it batches if you instantiate the same material in different variables.
Your answer
Follow this Question
Related Questions
How can I lower Decal draw calls at runtime? 1 Answer
Drawcalls reduction 1 Answer
lowering draw calls 5 Answers
2 materials/shaders 1 texture? 2 Answers
Can I have multiple/alternate UV textures for one mesh in a single file? 0 Answers