Recently I have been asking about how to modify single vertex or triangle in mesh in topic Optimized vertex manipulation - Questions & Answers - Unity Discussions . As it turned out, there are basically 2 reasonable ways how to do it showed in manual Unity - Scripting API: Mesh , specifically #2 and #3. I don’t clearly get when is using #3 better then #2. In manual is written "Continously changing the mesh triangles and vertices ". I did some experiments and from my sample observation, manipulating triangles using #2 approach works as well and seems to be faster.
int[] triangles = _objectMeshFilter.triangles;
triangles[GetTriangleLastIndex(nthTriangle)]--;
_objectMeshFilter.triangles = triangles;
It seems to me that #3 is only good if I want to change number of vertices or triangles in mesh, other it just creating unnecessary work to garbage collector.
Should I be aware of something using #2 approach ? In what situations should I rather use #3 ?