Forum rules - please read before posting.

Tool Tips for Inventory Bar

Hi,

I am very new to AC and have been working on creating tool tips for my Inventory items when the mouse hovers over one of them. In my script I have hooked into the OnMouseOverMenu event. At that point I am trying to show the details for the item in a floating window.

This has posed some challenges as the event does not fire when I move off the item. It only will fire again if I move over another menu or in my case one of the buttons in the inventory bar. In other words the element parameter returns a label of InventoryBox weather I am over an item or over the background of the inventory box.

In order for me to show or hide the tool tip window I need to have the event fire when it enters and leaves a item. This way I can toggle the window active or not.

I have look through the EventManager code for what else is available but did not see an event that I could hook into that would work for me.

I am wide open to suggestions on how one may go about achieving this in AC.

Thanks

Comments

  • The OnMouseOverMenu event includes the element's "slot" parameter, and should be called again if the mouse moves from one slot to the next. In the case of the InventoryBox element, each item is given its own slot.

    You can get the exact inventory item at this slot with:

    InvItem hoverItem = inventoryBox.GetItem (slot);
    

    Note that this may be "null" if you allow empty slots via the Can re-order items in menu? field in the Settings Manager.

    If the event itself is not firing correctly, please share more details - including your AC/Unity version numbers, as well as details of your menu and settings.

  • Hi Chris,

    I was able to figure out what was going on with the event and adjusted my code accordingly.

    One thing I can think of to make this easier to track would be to send in a -1 on the slot number if not entering a slot. The element title for the inventor bar is Inventory Bar weather you are on a slot or not. I does change when you are over one of the buttons.

    Not sure this is doable in your codebase but just a though.

    Thanks,

  • Is yours an AC menu or a Unity UI menu?

  • The menu used for Inventory is a Unity UI Prefab.

  • If you're using Unity UI, then you're either over an element slot, or not over an element at all. You should be getting a null value in the MenuElement parameter otherwise. If you're getting different behaviour, please share more details in the form of version numbers, menu screenshots, and custom event code.

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.