- Home /
Creating a submesh Unity
I have vertices, normals & triangles with me that are larger than 65k. How can I create a submesh to get around "vertices too large" issue? If i import a model with 65k vertices unity splits in the editor. But if I am going to assign a vertex array in C# code to a mesh how do I split? Looked into Unity's SubMeshCount, or SetTraingles but how do I actually code it?
It seems like you are looking for the wrong thing. Unity splits meshes with more than 65k verts into new meshes, it does not split them into submeshes because that wouldn't lower the verticies per mesh.
A simple mesh looks like the following
$$anonymous$$esh
-array of Vector3s which define the verticies
-array of ints used to define the triangles. Each int is the index of a vertex and every 3 ints are used to get 3 verticies.
A mesh that uses submeshes looks like the following
$$anonymous$$esh
-array of Vector3s which define the verticies
Sub$$anonymous$$esh1
-array of ints that are used to define the triangles of submesh1
Sub$$anonymous$$esh2
-array of ints that are used to define the triangles of submesh2
As you can see, submeshes use the verticies of the overall mesh so using submeshes won't let you split the verticies. You probably want to define mulitple meshes like Unity does on import.
Thanks that does help. But dividing a mesh co$$anonymous$$g from an Obj (text file) is going to be tough! Because I will have to split the vertex array into two, and then make sure my triangles are defined in right mesh (that have the vertex) - basically all the association.
But glad to know submesh is useless for my 65k vertices problem! Thanks...