- Home /
Static batching - Getting submesh
So I am using static batching. However I am also working with individual meshes, even on static objects. When using static batching, Unity replaces the meshFilter.mesh and meshFilter.sharedMesh with a mesh which contains all batched meshes (usually named something like "Combined Mesh (root: scene)"). The problem is that even though that mesh is organized in submeshes, there seems to be no way of telling which submesh a particular MeshFilter (or Renderer) is using. I can tell that they are in a static batch by the Renderer.isPartOfStaticBatch field.
So my question is: Is it possible to get the submesh for a specific MeshFilter/Renderer or in any way get the mesh data they are actually rendering and not clumped together with all other batched meshes?
Answer by MrPhil · Jun 28, 2013 at 04:29 PM
This Question's answer is the best I could come up with: RaycastHit, triangleIndex, and submeshes - which submesh?