private IEnumerator TransitionLeft() { highscoreText.enabled = false; RectTransform menuRT = menuList[actualMenu].GetComponent <RectTransform>(); Vector2 originalPosition = menuRT.anchoredPosition; Vector2 targetPositionLeft = originalPosition - Vector2.right * 1000; Vector2 targetPositionRight = originalPosition + Vector2.right * 1000; myBG.Change(); while (menuRT.anchoredPosition != targetPositionLeft) { menuRT.anchoredPosition = Vector2.MoveTowards(menuRT.anchoredPosition, targetPositionLeft, transitionSpeed); yield return(new WaitForEndOfFrame()); } ChangeMenu(1); menuRT = menuList[actualMenu].GetComponent <RectTransform>(); menuRT.anchoredPosition = targetPositionRight; while (menuRT.anchoredPosition != originalPosition) { menuRT.anchoredPosition = Vector2.MoveTowards(menuRT.anchoredPosition, originalPosition, transitionSpeed); yield return(new WaitForEndOfFrame()); } }