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
- 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.