private IEnumerator AnimateMove(GameObject parent, float xPosition) { parent.GetComponent <ContentSizeFitter>().enabled = false; parent.GetComponent <LayoutGroup>().enabled = false; for (int i = 0; i < parent.transform.childCount; i++) { LevelObject o = parent.transform.GetChild(i).GetComponent <LevelObject>(); RectTransform rt = o.GetComponent <RectTransform>(); o.MoveTo(new Vector2(rt.anchoredPosition.x + xPosition, rt.anchoredPosition.y)); yield return(new WaitForSeconds(0.05f)); } yield return(new WaitForSeconds(0.5f)); }