private void PopulateButtonTextWithItemInstance(Button button, Text buttonText, EventTrigger eventTrigger, ItemInstance currentItem) { if (currentItem.GetRemainingUses() > 0) { buttonText.text = "Use " + currentItem.GetIdentifier() + " [" + currentItem.GetRemainingUses() + "]"; long instanceId = currentItem.GetInstanceId(); eventTrigger.triggers.Clear(); EventTrigger.Entry pointerEnterEntry = new EventTrigger.Entry(); pointerEnterEntry.eventID = EventTriggerType.PointerClick; pointerEnterEntry.callback = new EventTrigger.TriggerEvent(); pointerEnterEntry.callback.AddListener(delegate { UseItemInstance(instanceId.ToString()); }); eventTrigger.triggers.Add(pointerEnterEntry); button.interactable = true; } else { buttonText.text = currentItem.GetIdentifier() + " [0]"; button.interactable = false; } button.gameObject.SetActive(true); }