public override void OnPointerUp(PointerEventData eventData) { if (hoverItem != null) { unityEvent.Invoke(); if (!hoverItem.successful) { inventory.AddItem(hoverItem.item, index); } Destroy(hoverItem.gameObject); hoverItem = null; } }
public override void OnPointerDown(PointerEventData eventData) { if (item != null) { GameObject gobj = Instantiate(NSInventory.Resources.Instance.hoverItem); gobj.transform.position = transform.position; hoverItem = gobj.GetComponent <HoverItem>();; hoverItem.item = item; unityEvent.AddListener(hoverItem.OnMouseReleased); item = null; inventory.RemoveItem(index); } }