Forum rules - please read before posting.

Inventory Drag & Drop issue with highlighted color

edited June 2018 in Technical Q&A
Hello, I have a small issue I haven't figure a way to solve it.
I use drag and drop inventory interface with single interactions.
All my inventory slots have color tint transition with normal and highlight colors.
When pick an item from inventory the Slot(button) of that item becomes highlighted . When I release mouse button the cursor changes from Item Cursor to In-game Cursor (as it should) but the inventory slot-item-button remains highlighted until I click somewhere. How can I make the Inventory buttons to change to normal on mouse release?
Also following this when I drag an Item above itself due the fact that it is already highlighted it turns to normal color. Shouldn't this work reversed? I mean the moment you pick an item the Inventory slot to turn into normal and if you drag it above it then highlight?

AC : 1.63.2
Unity 2018.1.1f1

Comments

  • You're talking about a Unity UI-based Menu?

    • the inventory slot-item-button remains highlighted until I click somewhere. How can I make the Inventory buttons to change to normal on mouse release?
    This is a behaviour of Unity's built-in EventSystem.  Custom EventSystems can be written and assigned in the Menu Manager, but that's not an issue specific to AC.

    • the moment you pick an item the Inventory slot to turn into normal and if you drag it above it then highlight?
    This too is down to the way Unity UI behaves.  The Button's Transitions aren't aware of the concept of drag-drop-inventory, so when you're hovering an item over its own slot, it doesn't know that it should instead play the "normal" transition.

    What you can look into doing, however, is hooking into AC custom events so that you can change the "highlighted" color of an Inventory slot Button on the fly.  For example, when an item becomes selected (the OnInventorySelect event), you can write a script that finds that item's associated Button and changes the highlight color, e.g.:

    http://pasteall.org/992850/csharp

    That approach could also help with the above issue, too.
  • Yes I use Unity-UI based menus.
    Thank you very much for this solution Chris!! you are awesome!!! I will test it asap!
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.