void CloneBook() { for (int i = 0; i < BookDataLength; i++) { GameObject clone = Instantiate(MidCoverBook.gameObject, MidBookShelfContent.transform); CloningComponent cc = clone.GetComponent <CloningComponent> (); cc.BookIndex = CloningIndexCounter; cc.Catagory = bookData[i].catagory; CloningIndexCounter++; } }
void SetBookToThemShelf(CloningComponent cc) { for (int i = 0; i < CatagoryContent.Count; i++) { MidBookShelf _midBookShelf = CatagoryContent[i].GetComponent <MidBookShelf>(); if (cc.Catagory == _midBookShelf.Catagory) { cc.transform.SetParent(_midBookShelf.MidBookShelfContent); } if (MidBookShelf.transform.childCount >= 5) { SideScroll.SetActive(true); } if (_midBookShelf.MidBookShelfContent.childCount >= 5) { _midBookShelf.SideScroll.SetActive(true); } } }