// Update is called once per frame void Update() { if (isActiveAndEnabled && isModified) { foreach (ItemButton itemButton in playerInventoryPanel.transform.GetComponentsInChildren <ItemButton>()) { itemButton.heldItem.stock = playerInventory.GetStock(itemButton.heldItem); } } isModified = false; }