Batching between copied meshes (494563)

Hi, I’m trying to setup batching between different copies of a single mesh. I can’t use the original sharedMesh because I need to change its UVs per object (Unity breaks batching if I change the original Material, so I am changing the UVs instead).

This is how I copy the mesh:

Mesh newMesh = (Mesh)Object.Instantiate(skinnedMesh.sharedMesh);
skinnedMesh.sharedMesh = newMesh;

Then I change the UVs like this:

for(int i = 0; i < originalUVs.Count; i++)
    snapUVs[i] = this.m_originalUVs[i] + offset;

skinnedMesh.sharedMesh.uv = snapUVs.ToArray();

This all works fine as far as display, but automatic batching won’t work! Every object gets its own render call. I checked that the material was NOT cloned, so that’s fine. The Unity docs don’t say anything about the mesh having to be the same… So I’m not really sure where to continue from here.

Please help :frowning:

Well :

  • vtx count by objects?
  • do you have light into your scene?

Also not 100% sure about it, but I remember once Unity removed the dynamic batching on skinned model since it was more memory consuming than to do nothing to the end.

Total scene count is 96 vertices so that’s not it
No lights at all (this is a 2D game)

I think you are right about the skinned model not batching. I just did a test scene and NOTHING batches even if I remove all my scripts completely.

This sucks, badly. I wanted to avoid mesh combining but I don’t see any other way now.

[edit]Also unity should really update their docs. They are highly misleading. [/edit]