[Solved] Static Batching Is Broken

Hi,

It seems that static batching is not working at all for me in Unity 5.6b5.

Object marked as static that I would expect to static batch seem to be using dynamic batching under some cases (according to Frame Debugger). If I turn off dynamic batching in player settings, no batching occurs at all :frowning:

I made a simple test scene, just 2 cubes with the default material. I have marked them both as “Batching Static”. I have disabled Light and Reflection probes. I also disabled the directional light to make the frame debugger cleaner.

Here is what I see with dynamic batching on:

and dynamic batching off:

I will admit this is my first time trying to static batch something, so I could be missing something fundamental… any takers?

On a kind of related note, should I be expecting static lightmapped objects to batch if I only have a single lightmap in the scene? That is where I originally noticed the issue. I am using a stationary light in ShadowMask mode. I would think that if my static scene objects don’t batch… it kind of makes the performance gains from lightmapping everything null and void. Thoughts?

Cheers,

Niall

Edit: It’s probably also worth saying that the Profiler window agrees with the FrameDebugger and Stats window, no static batching is happening.

I have also just tried changing both cubes material to an Unlit Color material/shader. No luck there either.

Everything’s OK, nothing to see here!

I had a niggling feeling this might be a knowledge gap…

It seems that the static batches are ONLY created when you actually build a player, as far as I can tell, there is no way to make sure anything is static batching inside the editor.

I verified that they were in fact batching by building a standalone player and connecting the profiler to it (via 127.0.0.1, the WindowsPlayer target wouldn’t work for some reason). At this point, you can see the static batches by highlighting the Rendering data row, the information is in the bottom pane.

I scoured the internet and docs for this information, but could not find it. Maybe this will help some other brave traveller down the line :wink:

1 Like

If you enter the playmode in the editor static batching will be functioning too.

2 Likes

Can’t believe I didn’t notice that. Thanks for the heads up!