Inventory Slot with Click & Drag n Drop functionality

Hello, Im trying to make a inventory system where the place has the ability to drag n drop items into different slots within their inventory, but they also can click on a slot in their inventory and thus it will display information about what is in that slot.

So far I’m unable to have both work as one consumes the input and meaning the other will not work.
Do i need to scrap using the on drag detected and make a custom system using on tick?

Any help is much appreciated

Did you use a native button for the ability widget? If so, avoid it. A user widget can pass Unhandled to reach a layer underneath.

No i was using the on mouse down function overide.
Does leaving it unhandled cause any issues?

It’s the solution. The widget (ability) can process the click → on mouse down pass Unhandled → click arrives at the slot underneath → process on mouse down and pass Handled. That’s providing you do not want to have yet another widget (or player controller) receive input.

I See. at the moment i don’t have another widget or player controller receive input. But that might change in the future.

What’s the best way of going about this? I saw your reply on a similar post and i see the poster got it working with both of the replies.

I was confused though as to how would you trigger the on drag and drop function without using the “Detect drag if pressed” on the mouse button down

is there any other ways of being able to allow drag while also allowing the slot to be clickable?

1 Like

Try detecting the drag like so:

Essentially, this should return a Handled Drag Detection only if the user wiggles the mouse enough. A steady click with no wiggle should return Unhandled.

I feel so stupid. Im unsure how to implement it. if possible would you be able to show me a quick snippet on how to implement it?

As in implement some code if the player clicks but doesn’t move and implement this is a drag is detected

Can you show your onMouseDown? Where you detect the drag?

I original erased everything to try implement what you posted.

I believe i’m on the right track now is this how you would implement it?

Also curious how did you get rid of the grid background on that photo?

I’d do it like this:

Try it, see if that delivers. Do you need to Branch there? Because slot click would be implemented in the Slot widget and trigger on its mouse down.

1 Like

so essentially created a border that handles the drag and the on click functionality would be kept inside the widget itself, correct?


That looks spot on, should :crossed_fingers: work. Does it?

1 Like

It does. Thank you very much for your help

1 Like