public void ClearItemList() { if (ItemListGroup.Find("Categories").childCount > 0) { for (int i = ItemListGroup.Find("Categories").childCount - 1; i >= 0; i--) { Destroy(ItemListGroup.Find("Categories").GetChild(i).gameObject); } } ResetSelectedItem(); }
public void PopulateItemList() { ClearItemList(); CraftableItem[] itemArray = craftingController.FetchItemsForProfession(Player_Skills_Script.ConvertStringToSkill(selectedProfession)); selectedItems = itemArray; if (itemArray != null) { for (int i = 0; i < itemArray.Length; i++) { GameObject obj = Instantiate(ItemListingPrefab, ItemListGroup.Find("Categories"), false); obj.GetComponent <Crafting_Select_Interface>().Ind = i; obj.transform.Find("Name").GetComponent <Text>().text = itemArray[i].ItemName; obj.transform.Find("Level").GetComponent <Text>().text = itemArray[i].RequiredProfLevel.ToString(); obj.transform.Find("Icon").GetComponent <Image>().sprite = itemArray[i].Icon; } } }