MoveTowards used on a path causes lag in build
Hello,
I am using a List<Vector3>
to store all the position Vectors for an automatically generated path.
So, I'm using Vector3.MoveTowards(currentPos, targetPos[i], Speed*Time.smoothDeltaTime)
to move an GameObject
from one point to the next, always increasing the i
variable (which is a global variable) when the distance between the GameObject
and the targetPos[i] is smaller than 0.01f
.
Somehow this is causing a a laggy movement in the build, and I can't find any concrete reason for it.
Are Lists of 50 Vectors too big for current mobile capacity or am I using the wrong incrementing method by checking the distance?
Thank you very much for any answer you could give!
Your answer
![](https://koobas.hobune.stream/wayback/20220612170203im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
FPS drop beacause Dialog with 200 images in it 0 Answers
Spawning objects one by one or in chunks (performance question) 0 Answers
Inexplicable performance difference in Unity Android 0 Answers
Low framerate on Android devices 0 Answers
Unity Basic Project Lags on Android, works perfect on Editor 0 Answers