Why is this code lagging on my mobile ( android ) ,whenever it runs and not on my pc? . Please help anyone!!
public void AboutBtn() { StartCoroutine(about()); }
IEnumerator about()
{
float elapsedTime = 0f;
float lerpDuration = 1f;
menuBool = true;
menuBarAnim.Play("menuBarAnimationB");
sidebarAnim.Play("SideBarAnimB");
Vector2 Origin = MoverR.anchoredPosition;
Vector2 Destix = new Vector2(Origin.x, -3658); //replace 6050 with the position you want
while (elapsedTime < lerpDuration)
{
elapsedTime += Time.deltaTime;
MoverR.anchoredPosition = Vector2.Lerp(Origin, Destix, elapsedTime);
yield return null;
}
anim = false;
menuBool = false;
}