public void Prime(Inventory inventory) { for (int i = 0; i < targetTransform.childCount; i++) { Destroy(targetTransform.GetChild(i).gameObject); } this.inventory = inventory; List <Item> items = inventory.items; foreach (Item item in items) { ItemDisplay display = (ItemDisplay)Instantiate(itemDisplayPrefab); display.transform.SetParent(targetTransform); display.Prime(item); } }
private void CreateItemDisplay(Item item) { ItemDisplay display = Instantiate(itemDisplayPrefab, transform, false); display.Prime(item); }