private void GenerateCollectionList(List <Collection> collections) { GameObject tmpCollectionGo; /// Destroy all children foreach (Transform child in ParentViewPortGo.transform) { GameObject.Destroy(child.gameObject); } foreach (Collection collection in collections) { tmpCollectionGo = Instantiate(CollectionPrefab, ParentViewPortGo.transform); CollectionController collectionController = tmpCollectionGo.GetComponent <CollectionController>(); collectionController.LoadingScreen = LoadingScreenGo; collectionController.CarpetListGo = CarpetListGo; collectionController.FillContent(RoomCategoryId, StyleCategoryId, collection); } }