public void UpdateInventory() { Button[] buttons = itemPanel.GetComponentsInChildren <Button>(); foreach (Button b in buttons) { Destroy(b.gameObject); } if (party.InventoryNotEmpty()) { for (int i = 0; i < party.playerInventoryCount.Length; i++) { if (party.playerInventoryCount[i] > 0) { GameObject btn = Instantiate(inventoryButton); InventoryButtonController btnCont = btn.GetComponent <InventoryButtonController>(); btnCont.invPanel = itemPanel; btnCont.invItemNum = i; } } } }
void Awake() { Instance = this; }