I have a procedurally generated 2D mesh in a 2D scheme.
void ConstructMesh()
{
mMesh.Clear();
mMesh.vertices = vertices;
//mMesh.normals = normals;
mMesh.triangles = triangles;
mMesh.uv = uvs;
mMeshFilter.sharedMesh = mMesh;
mMesh.RecalculateNormals();
mMesh.RecalculateBounds();
//mMesh.Optimize ();
}
This is called after each update. However, it would appear that it only works once. Basically my script adds quads (2 triangles) in repetition with the intent to create a trail. I see the values updating correctly, but only one quad (The first one) gets displayed.
mMeshFilter = GetComponent<MeshFilter>();
mMesh = mMeshFilter.sharedMesh;
The mesh is fetched like this.