private void FillGallery(EventModel eventModelReference) { int count = eventModelReference.Graphics.Count; GameObject gallery = GameObject.Find("ListGallery"); int childrenCount = gallery.transform.childCount; for (int i = 0; i < childrenCount; i++) { gallery.transform.GetChild(i).gameObject.SetActive(false); } for (int i = 0; i < count; i++) { GameObject rect = gallery.transform.GetChild(i).gameObject; rect.SetActive(true); rect.GetComponent <Image>().sprite = SpriteHelper.CreatSprite(eventModelReference.Graphics[i]); } }