Drag widget and drop on actor.

You can bind the mouse as an input and use that.

I’m also curious as to why you delay two frames before calling your interface?

There is already exactly the same question, but it was closed due to beautiful reason: https://answers.unrealengine.com/questions/536407/umg-to-actor-drag-drop-detection.html

Seems like drag’n’drop operation consumes mouse events. Is there an accessible event outside widgets so I could detect mouse release or drop on actor itself and could fix my current redneck solution?

Extend the drag&drop operation - it has 3 overridable functions - Drop / Drag / Cancel - all returning pointer data. You can then line trace for world objects while dragging.

The Player Controller does not know what is happening to the cursor during the drag, the operation does. Details in my post here.

You can bind the mouse as an input and
use that.

What do you mean?

Completely irrelevant and a link to a 20 min video instead of simple answer. Next time please consider respect people’s time if you want to help them,

Thanks man, does custom operation work with widgets or it stop being registered for some reason?

It only works with widgets. It’s the same as the normal drag & drop operation but you can flesh it out with features.

It’s like default Player Controller vs Your Own Fancy Player Controller. It allows you to add data and handle additional logic.

So is internal event OnDrop called anyways even if you don’t release LMB on widget?

It’s not, no widget to drop on = no call. You can evoke drop cancelled, though. I’m actually unsure what is the purpose of Drop in the DragOperation. :expressionless:

The Dragged is super-useful for what you need - getting cursor position and checking what’s underneath; deproject screen to world and trace.

I can’t remember precisely, but you will most likely need to provide the drag & drop operation a reference to the player controller as these two normally can’t see one another. This screenspace / world space interaction is not something UMG was designed for, it seems :expressionless:


There is another hackaround (apart from your crafty (!) 2 frame delay in order to read cursor data from the controller).

You can cover the entire screen with a visible canvas during drag - that canvas will know what is being dragged over it and where it’s heading:

274035-27d13da7fd1157865f582a5af5481ff5.gif

As you can see, it’s possible to drive both a widget and a world object during the same tick like this. It’s hacky but it does work. From here you can treat that cube as a collider and have it interact with the world.

Anyway, coming back to the non-hacky solution, here’s a quick wrap up that actually does not require you to send player controller reference anywhere but uses a dynamic dispatcher bind instead:

The Custom Drag and Drop Operation firing a dispatcher with 2d vector:

Detecting Drag:

The Player Controller event (with 2d vector so the signatures match):

Hmm so far it’s seems that my solution wasn’t so bad :smiley:
Anyways thanks for the interesting example! I’ll mark your answer as appropriate, since Dragged is technically what I asked for.