- Home /
Question by
Slender2000 · Jul 12, 2020 at 07:43 AM ·
2dmeshvertices
How to stop vertices beeing laggy?
Hi, I have a script with tells verticles of object to follow children spheres. The problem is when I'm adding a offset Its starting to be laggy. I'm adding a script and screenshots to explain better.alt text
void Update () {
for (int i = 0; i < vertices.Length; i++)
{
vertices[i] = points[i].transform.localPosition * offset;
}
mesh.vertices = vertices;
}
normal.png
(93.7 kB)
notnormal.png
(81.9 kB)
Comment
Answer by logicandchaos · Jul 12, 2020 at 03:14 PM
It's probably cause you are doing it in update and it is making that calculation too many times, you should use the profiler to make sure the script is causing the performance issue, but there are a few things you could do to make it more efficient. You could setup a timer so it only gets called once a second or something, or you could call it only when the parent object moves.