private void MoveBackGroup(Transform parent, Transform switchToParent = null) { int numChildren = parent.childCount; for (int i = 0; i < numChildren; i++) { UiItem item = parent.GetChild(i).gameObject.GetComponent <UiItem>(); if (item != null) { item.MoveBack(); if (switchToParent != null) { item.transform.parent = switchToParent; } } else { Debug.LogError("UiManager try to MoveBackGroup a parent that has non-UiItem child"); } } }