IEnumerator loadImages() { foreach (var book in listGameObjectBookAdded) { BookListItemController bookListItemController = book.GetComponentInChildren <BookListItemController>(); yield return(bookListItemController.loadImg()); } }
private void loadListBook() { foreach (var go in listGameObjectBookAdded) { Destroy(go); Debug.Log("remove gox" + listGameObjectBookAdded.Count); } listGameObjectBookAdded.Clear(); BooksFireBaseDb.getInstance().getBooksFromLocal(books => { foreach (var book in books) { GameObject g = GameObject.Instantiate(bookListItemPref); g.transform.SetParent(contentGridLayout.transform); g.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); listGameObjectBookAdded.Add(g); BookListItemController bookListItemController = g.GetComponentInChildren <BookListItemController>(); bookListItemController.bookInfo = book; Debug.Log("add gox" + listGameObjectBookAdded.Count); } }, catName); listUiScrollRect.normalizedPosition = new Vector2(0, 1); }