Jerky Lerp animation on iOS devices using IEnumerator. Any ideas?
Hey there. I'm creating a word game that uses tiles. As each tile is clicked it moves to a set position on the screen to show that it's in use. I am moving these tiles using an IEnumerator
as my understanding is that is a more efficient way to do it over the Update
function The code itself works fine. The only issue I have with it is that when I build to an iOS device (iPod 6 or iPad Pro 10") and play the game, this animation in particular is jerky. It runs smoothly on my laptop (MacBook Pro 2012) so I'm not sure where it's getting the extra jerkiness from. Am I doing something wrong or overloading the system somewhere? The maximum number of tiles moving at once would only ever be about 3 to 4 and even then those are just using a single frame sprite. Any thoughts on where the issue may be?
//moves the tile to the correct position on the playing board
IEnumerator PlayTile(Transform target)
{
target = TileManager.Instance.NextFreePos;
while (Vector3.Distance(transform.position, target.position) > 0.05f)
{
transform.position = Vector3.Lerp(transform.position, target.position, smoothing * Time.deltaTime);
yield return null;
}
}
Your answer
Follow this Question
Related Questions
How to get a drawn line to snap into a shape? 0 Answers
Blending from ragdoll to animation bug 0 Answers
How to reduce the scale of the x and z axis ,How to reduce the x and z scale in a time lapse 0 Answers
Movement for GameObject[] in arrays jittery when using Lerp in Coroutine 0 Answers
How can you increase a float to certain number and stop, while it is being used. 2 Answers