Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Is there an "On Inventory Menu Item Hover" delegate event?

As the title says, is there a delegate that triggers when the player changes the item being hovered in the inventory menu?

Comments

  • Not specifically, but you can hook into the OnMouseOverMenu event - which is triggered when hovering over any menu element - and drill down from there:

    using UnityEngine;
    using AC;
    
    public class DetectMouseOverItem : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnMouseOverMenu += OnMouseOverMenu; }
    
        private void OnDisable () { EventManager.OnMouseOverMenu -= OnMouseOverMenu; }
    
        private void OnMouseOverMenu (Menu menu, MenuElement element, int slot)
        {
            if (element != null && element.title == "InventoryBox")
            {
                MenuInventoryBox inventoryBox = element as MenuInventoryBox;
                InvItem mouseOverItem = inventoryBox.GetItem (slot);
                if (mouseOverItem != null)
                {
                    Debug.Log ("Mouse-over " + mouseOverItem.label);
                }
            }
        }
    
    }
    
  • edited February 24

    That's cool! Thanks.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!