private void AddToInventoryPanel(ItemButton itemButton, ItemInstance itemInstance) { //If the player inventory doesn't have the item then we'll need a new button. if (!playerInventory.HasItem(itemInstance)) { ItemInstance newItemInstance = new ItemInstance(); newItemInstance.item = itemButton.heldItem.item; newItemInstance.stock = 1; ItemButton newItemButton = AddNewItemButton(newItemInstance, playerInventoryPanel); } }