I’m creating a tooltip system for my inventory using the UI features in Unity, however, I’ve found that OnPointerExit is never being called. OnPointerEnter and Down both work fine, it’s just Exit that doesn’t and I don’t understand why. If none of them worked it would at least make more sense.
Any help would be greatly appreciated.
Inventory Slot:
public void OnPointerEnter(PointerEventData ped)
{
if(inv.items[slotNumber].itemName != null)
{
inv.ShowTooltip(inv.slots[slotNumber].GetComponent<RectTransform>().localPosition, inv.items[slotNumber]);
}
}
public void OnPointerExit(PointerEventData ped)
{
Debug.Log ("Pointer Exited Slot.");
inv.HideTooltip();
}
Inventory:
public void ShowTooltip(Vector3 tooltipPos, Item item)
{
if(item.itemType == Item.ItemType.Consumable)
{
consumableTooltip.SetActive(true);
}
}
public void HideTooltip()
{
Debug.Log ("Hiding Tooltip.");
consumableTooltip.SetActive(false);
}