/// <summary> /// When we select an item, keep a reference to the item model and enable the slider /// </summary> /// <param name="item"></param> private void onSelectedItem(InventoryItemQuantity item) { this.selectedItem = item; selectedItemNameText.text = item.Name; quantitySlider.value = item.Quantity; quantitySlider.interactable = true; quantityText.text = item.Quantity.ToString(); }
/// <summary> /// If we deselect the selected item, disable the slider /// </summary> /// <param name="item"></param> private void onDeselectedItem(InventoryItemQuantity item) { if (this.selectedItem == item) { this.selectedItem = null; selectedItemNameText.text = "-"; quantitySlider.value = 0; quantitySlider.interactable = false; } }