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 <em>= this.m_originalUVs *+ offset;*</em>
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