Dynamic Batching limited to 100 items?

Hi. I’m creating a simple 2d game using sprite manager 2. I have a bunch of sprites in my scene all using the same material. I’ve been trying to find out why I have more draw calls than I should and much trial and error I think I found out why. It seem if I put 100 sprites of the same prefab all in the same scene with the same material they all batch fine and I get one draw call. If I add one more and make it 101 I get 2 draw calls. Is there a limit to the amount of items that can be batched into one draw call or is something going wrong? Is this a bug?

Thanks

The section on Dynamic Batching states it cannot have more than 300 vertices in a single dynamic batch. This is to the per vertex overhead it uses. I’m actually a bit confused as you can get 100 sprites, as that to me would be 400 vertices.

Edit: Unity Link
http://unity3d.com/support/documentation/Manual/iphone-DrawCall-Batching.html

Yeah, I did some research on that and it seems that the 300 limit is actually 300 per object not 300 total, so it’s not relevant.

From what mentioned on another thread these 300 vertices though are in relation to a standard vertex, that means a vertex that only contains position,normal and a single uv channel. if your vertex contains more the number of vertices for batching will be lower

you went right over my head on that one… lol

What does that mean exactly?

That means if the vertex data in the mesh you import has more than position, normal and an uv channel, for example also a tangent and a second UV, then your vertex limit will be smaller than 300 per object to batch (if it were to percentually drop it would be around 180 vertices with this full set of data, not sure its percentual though so best search for the corresponding thread if you want to read it the whole information), no longer 300 vertices

He means objects that use more than one set of UV’s (lightmapped objects, for instance) are actually using more verticies than just the basic vertex count…

Oh ic. Well, I’m using Sprite Manager 2, so they all have only 4 verts, so I’m well below the limit.

So is 100 the limit of actual gameObjects that can be batched together, regardless of vertex count? I would assume there wouldn’t be a limit. If there’s not supposed to be a limit, could it be a Unity bug? I’m using the latest version on Unity, 3.1.0f4

I’d really like to hear from the Unity team whether this is a limitation on purpose or not. I need to decide if I should redesign the objects, putting a few of them into a single sprite. The problem is that there will be many different combinations of these objects so I’ll have to make a whole lot more textures

Using the latest version just to test I put in 841 of the same game object and it batched them all no problem.

@Wylin: You only had one draw call? I just tried it with a new, empty project. I created a cube and gave it a default diffuse material, no texture or anything. I duplicated it 24 times and I had 1 draw call. As soon as I made 25 I got 2 draw calls. So it seems with a cube I’m limited to 24 items. I guess because the cube has more vertexes than a sprite.

btw, once I get the 25 I have 24 batched, 2 draw calls. at 26 I have 26 batched and 2 draw calls.

Does anybody know if this is a bug or if it’s they way its meant to be? If it is a bug and could be fixed before my game launches it would drastically help performance, mostly on older devices