Static batching not combining meshes on Windows standalone build

I have a scene with 4 game objects. Three of them are set to static, while one is kept dynamic.

  • 1 cube (static)
  • 1 sphere (static)
  • 1 capsule (static)
  • 1 cylinder (dynamic)

I store a list of names of all the static meshes, and another list of names of all the dynamic meshes.

The number of static and dynamic meshes are logged using Debug.Log. The names of the processed meshes are also logged.

When running the game in the Editor (Play mode) the console reports 1 dynamic mesh and 1 static mesh. In this case, the name of the static mesh is “Combined Mesh (root: scene) Instance”.

When running the game in a Windows build the log file reports 1 dynamic mesh and 3 static meshes. In this case, the names of the static meshes stored are: “Sphere”, “Cube” and “Capsule”.

Why is there such a difference in the results?

Thanks in advance.

The mesh names were being retrieved by accessing the MeshFilter.mesh.name.

In the Editor, the MeshFilter.mesh was returning a combined mesh, while in the standalone build it wasn’t. The problem was solved by using MeshFilter.sharedMesh instead.

Using the sharedMesh, the result was the same when running in the Editor and when running in the Standalone build.