I have a prefab that has a mesh ,the mesh has 100 vertices ,I use this code to change vertices position,but its super slow !!!
(there are 500 clones of this prefab in the scene)
using UnityEngine;
public class Test : MonoBehaviour
{
public Mesh m;
public Vector3[] MyVertices;
void Update()
{
for (int a=0;a< MyVertices.Length;)
{
MyVertices[a] = new Vector3(MyVertices[a].x+0.0001f, MyVertices[a].y + 0.0001f, MyVertices[a].z + 0.0001f);
a++;
}
m.vertices = MyVertices;
}
}
when I move the prefab with transform its fast but changing vertices is like 100 times slower, how can I speed up it?
I just want to change position of vertices but when I do this its just like creating a new mesh !!!