submesh during gameplay

So I have been doing some research on submeshes because of the problems ive been having trying to get my city builder to work. Anyway, the question:
How do you change which vertices are part of a submesh during gameplay? Ive had a look, and the unity docs are quite vague, so can you give me some advice? What code do I use?

I use unity script, if that’s useful… Anyway, thanks :slight_smile:

you had to iterate mesh.triangles, like this (I don’t test this code!)
gettriangles returns triangles for a single submesh.
triangles are vertex index for the triangle mesh.

for(int i=0; i<mesh.subMeshCount; i++)
     int[] tris = mesh.GetTriangles(i);
     foreach(int tri in tris)
         Vector3 vert = mesh.vertices(tri);
         Do what do you want


Or similar