Answers for "Mesh.vertices is too small?"
http://answers.unity.com/questions/423569/meshvertices-is-too-small.html
The latest answers for the question "Mesh.vertices is too small?"Answer by col000r
http://answers.unity.com/answers/1137125/view.html
The problem is that while it's okay to update the position of vertices, Unity doesn't react well to you changing the *number* of vertices, because it immediately checks it against the triangles and complains. Even though you were probably about to assign new triangles as well, it's too late - the Error is already there.
The trick is to do **mesh.Clear()**, and then set everything anew: vertices, triangles and whatever else you assigned.Wed, 03 Feb 2016 08:06:28 GMTcol000rAnswer by Steven-Walker
http://answers.unity.com/answers/636652/view.html
I ran into this error with a custom editor script that generates geometry dynamically. Even though my vertex and triangle counts were correct, the error was still occurring intermittently. The solution was to create a new Mesh every time when regenerating the polygons, rather than trying to modify an existing mesh. Also be sure to set the vertices before triangles.Tue, 11 Feb 2014 01:04:13 GMTSteven-WalkerAnswer by Fattie
http://answers.unity.com/answers/423635/view.html
in a word ...
say a model has 100 triangles.
this means it will have 300 vertices.
[aside .... see note on "shared vertices" below]
recall that any TRIANGLES array simply has three entries for each triangle
so your TRIANGLES array will have 300 entries, and your vertices array will have 300 entries
say you want to take away 11 triangles
now, your TRIANGLES array now has 89 triangles, and is hence 267 length.
you now have 267 vertices so you'll need an all-new vertices array with 267 vertices.
note that the TRIANGLES arrray is the key thing you have to change, if you want to get rid of some triangles.
you "just have to" change the VERTICES each time you change the triangles for any reason.
however, don't forget that sometimes, you share vertices in thevertices array.
it's critical to understand that **you do not have to** share vertices, but you can if you want
So you might have two triangles (six verts). the TRIANGLE array **would be and must be** length six because you have six verts (two tris).
however, imagine you are sharing two of the vertices (draw a diagram)
so, if you wanted to do that, your verts array would be only four long.
again note that you DO NOT HAVE TO, for any reason, share vertices
this is a common misconception .. here is an ancient argument about it
http://answers.unity3d.com/questions/193695/in-unity-is-there-a-fast-way-to-find-nearby-triang.html
actually, it is much easier, when you are starting out, to **not share** vertices
quite simply: your verts array will always be the **same length** as your triangles array
So in a word .. it's the TRIANGLES array, you want to change, in this situation.
Hope it helps.
there are many discussions on these issues here
http://answers.unity3d.com/questions/329116/do-we-need-to-call-recalculatenormals-if-normal-ve.html
http://answers.unity3d.com/questions/352513/ways-of-modificating-mesh-triangles.html
BTW it's important to remember that when you access .vertices it CREATES A WHOLE COPY, it's a real gotchya in Unity when you're getting started. CheersSun, 24 Mar 2013 10:47:25 GMTFattie