When a player drags an item out of the inventory, I need the inventory to automatically close, when their mouse pointer (holding the item) leaves the inventory UI backdrop.
I'm using a drag and drop interaction, but in this case the object they need to drop the item on is right at the top of the screen, and obscured by the inventory menu whilst it's open.
I'm using the Unity Ui prefab inventory menu, with appear type manual.
Is there a way to trigger some kind of on mouse leave IF theyre holding a dragged item? or will i have to have a global always hide the inventory when the cursor leaves the rect transform of the menu?
Any advice would be gratefully received.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
What you could try is having an invisible Menu that spans the same area as your Inventory, but with an Appear type of Mouse Over. That way, you can run its ActionList when turn off asset whenever the Player leaves its area.
The Inventory: Check selected Action can then be used to check if the Player currently has an item selected.
Thanks Chris, great idea. I'll give this a go but have just thought, in some cases i need the player to drag one item onto another in the inventory, so I'll need to leave a bit of tolerance in my invisible menu to avoid a frustrating UX, or it accidentally closing, on a rogue mouse move