If I understand your requirements, this should work:
Vector3[] vertices = new Vector3[faces.Length*3];
int[] tris = new Vector3[faces.Length*3];
for (int i = 0; i < faces.Length;)
{
for (int j = 0; j < faces[i].Length; j++)
{
vertices[i*3 + j] = nvaces[i,j];
tris[i*3 + j] = i*3 + j;
}
}
mesh.vertices = vertices;
mesh.triangles = tris;
This assumes that your faces always have exactly 3 vertices.
↧