Drag & Drop ; Drop not called ; how to drop in level

Hello!

I have an inventory from which I can drag items (this works fine). I can drop them back into my inventory (this works as well), and I would also like to be able to drop them on my level. The problem is that when I drop the item outside of my inventory widget, my On drop event does not get called.
I read somwhere that On drop events only work on widgets so I spawned an invisible widget on my entire screen but this does not help.

Any idea?

You need to add a box where you trigger your “drop on floor” logic when you drop your dragged item on it. This box should be in its own widget, then add this widget to your inventory widget.

Create a new widget name it “DropOnFloorBox” this widget should contain just a border or button whatever, now inside this blueprint go to the graph, functions and override “on drop”.
Inside this function you do your logic (get your item reference, drop it, empty inventory).
Go to your inventory widget, add the newly created dropbox widget in your inventory, set the size and the appearance inside your inventory widget

Edit: The drop widget should be not hit testable, when you drag your item, set visibility visible for this widget.

Thank you Jeel,

The visibility of the widget did the trick for “my invisible widget”, so it works now.

Would you know how I can check where I am dropping my object on the level ? For example, I want to only be able to drop the item on the couch, how do I check that my couch is under my mouse?
I tried this with a Get Hit Result Under Cursor by Channelbut I can’t make it work.

Multiple ways for that but yes line trace channel or type of object is the easiest. You can create a custom channel or type of object For you I think you should use a custom channel.

Go to Edit, Project settings, Engine, Collision, add a custom TRACE channel let’s name it DropOn, default response ignore for now.
Go to your static mesh and open it, it does not need to be an actor just the mesh. On the right side of the viewport, search collision. in collision preset tick custom. You should see your newly created channel. Tick Block. In the same tab check “generate overlap events” is on

Now this type of object will respond to your mouse when you do a get hit result under channel.
If you want all your mesh to respond your drop logic you should put the default response of your trace channel to block.
I remember long time ago, it can be a bit confusing when you start ue4 between channels and all.
And it should already be on, but just to be sure, in your player controller, class default, “enable mouse over events” must be on.

Thank you for your help Jeel,
This is what I did based on your advice:

](filedata/fetch?id=1852472&d=1610619419)
This returns as “not valid” however. Somehow I cannot access what is under my cursor by channel.
I did set my actor to block this custom channel and this set of nodes works if I call it somewhere else. I need the “operation” of my Drag&Drop which I cannot access somewhere else.
Maybe someone can see what I did wrong there?