(Case 946946) Dynamic Batching not working in a Player

Dynamic Batching is not working in a build, but does work in the editor. The included test-scene is made of a bunch of Cubes and a static camera. Each cube contains 24 vertices according to Unity’s Mesh Inspector.

Profiler

Reproduce

  • Open user attached project
  • Open Player Settings and notice Dynamic Batching is enabled
  • Press File/Build & Run to build a Windows Standalone 64bit player
  • Start Player
  • Connect and enable Profiler to running Player
  • Select “Rendering” tab

Observe “Dynamic Batching” shows “Batched Draw Calls: 0” always.

  • Quit Player and switch back to Unity Editor
  • Press Play in editor
  • Connect and enable Profiler to running game in Editor
  • Select “Rendering” tab

Observe “Dynamic Batching” shows “Batched Draw Calls: 797” always.

I’ve reproduced this issue with 2017.2.0b9 on Windows 64bit Standalone, UWP Windows and XboxOne.

Expected
Dynamic Batching should work in a build.

Hi Peter,

In a nutshell, graphics jobs are currently not compatible with dynamic batching.

The longer version is that we do not recommend using dynamic batching on modern platforms to begin with (including those that would benefit from graphics jobs).

The GPU side performance improvement tends to be vanishingly small, while the CPU overhead can be quite significant, because dynamic batching requires that all batched objects are transformed into world space on the CPU. Since the draw call overhead tends to be fairly low on modern platforms, this usually results in a net performance loss.

Hope that helps,
-Vlad

1 Like

Has Unity considered making the engine’s default settings appropriate for high-end games? Or maybe having the option to select the default quality level when creating a project? (linear color space, no dynamic batching, defferred rendering, GPU Skinning, Graphics jobs, etc…)

As for dynamic batching, it would be very pertinent to make it very clear that it is not a good thing to have in 99% of cases, and that it breaks graphics jobs. Otherwise people will see it and just say “Sure, I’ll take that fancy-sounding graphics thingy”

I feel like so many less-than-expert users are missing out on immense quality+performance gains in Unity simply because they aren’t aware of all this

Hi Vlad, thanks for your reply.

It would cause less confusion if Unity displays a message next to the “Dynamic Batching” setting, if it isn’t going to work, due to enabled Graphics Jobs for example. Plus, the editor shouldn’t make use of dynamic batching as well in this case. It’s odd if it works in the editor, but not in a build or visa versa.

Adding this information to the documentation sounds like it makes sense.

Furthermore, it’s unsatisfying if the engine dictates whether to support such feature. I, as a developer, would like to make that call after having measured performance with and without dynamic batching instead.

1 Like