Batched Draw Calls

Hey guys

Having some trouble with batched draw calls, in the editor I have a group of objects that all share the same material, at some points durin the application I am able to disable/enable that group and increase/decrease the draw call count by up to 10 draw calls.

  • All these objects are marked as static (and I have unity pro)
  • Static batching is enabled (does it only occur at post build runtime?)
  • They all share the exact same material
  • They are all unlit textured

Shouldnt this be batched as 1 draw call?

thanks

Recently, i have been playing around with draw calls… and it seems that the very least i can get with one material , about 12 models, and a light , is 2. I am assuming that if you have lights at all , than you wont get 1 draw call ever. As for the rest, im not sure.

  1. Unity Pro would be of no importance here cause mobile is distinct. But due to 2 its clear you have iOS Pro too :slight_smile:
  2. No static batching impacts all play modes / real runtime

Reason you get up to 10 might potentially be things like lights or projectors which add 1 drawcall per affected mesh

Or you use OnGUI which creates 1 drawcall per GUI.xxx call

Objects won’t batch if their local scale values differ.

Should not impact static batching as static objects don’t realtime transfer, their whole meshes are baked a single time, not continously.
Or are they really bugged on that end?

Hm, good question. I haven’t tested it with static batching, so perhaps that doesn’t apply.

I’ve experienced the same issue. I’ll have 10 objects all the same scale, all one material. Sometimes it batches to 1, sometimes to 6 or 8. I then turn off each object to see which ones are batched and which are not. But all in all, it makes no sense how it works. I must be missing something.

Static batching don’t care about scale iirc

Well, there might be something that breaks batching :wink:
Anyway, repro or it didn’t happen. And yes, as we are in release mode - you’d rather harry up

Perhaps you find in this thread a helpful alternative to static and dynamic batching.

@Alexey,
What can break static batching?

@Ippokratis,
Thanks for the batching alternative, I’ll try it out!

@Crazy Robot: Usage of Pixel Lights, forward rendering shadows and Projectors can make it look as if it breaks it, but in reality its still fine but each of the objects hit by the light / projector / on desktop with forward rendering shadows gets redrawn for the corresponding visual, resulting in a drawcall