[UMG] Drag & Drop detection not working

Hello, I’m testing drag & drop capabilities for my game prototype, I’m quite in advanced stage of development and now I figured out that drag detection isn’t working in UE4. I really don’t want to make my own drag and drop detection using mouse events, also I really don’t want to throw that project away. So what’s the problem?

Although finding some kind of minimalitic information about how to make drag detection withing UMG is quite impossible, I’ve downloaded some project to see how it’s done there - cannot reproduce it. So what do I do?

I create one parent widget which takes whole screen and serves as a container for my draggable widget.

Inside my draggable widget, I add image- to have some kind of “collision box”, so I set it’s visibility to visible. I create overrides for these events: MouserMove, DragDetected. For mouse move, I call DetectDragIfPressed and it’s result send to output. Of course I connect PointerEvent node as I should.

Now when I create override for DragDetected, it get’s never called. Detect drag if pressed is set to drag key - left mouse button. Widget is accepting mouse events as it should since the mouse move event gets fired correctly.

I’m lost, really don’t know what am I missing.

You’re constantly recreating the drag detection state. Every time the mouse moves, it’s sending ‘hey - prepare to detect drag’, which will reset the drag detection state, while it waits for a certain amount of pixels to be dragged.

You should move your logic to OnMouseButtonDown, and only do it when left is pressed.

i have the same problem with OnMouseButtonDown function. I don’t know whats the problem, it works perfectly with right mouse button but it doesn’t work on left mouse button

Guys, if someone doesn’t have the definition of drag and drop when you click the left mouse button, then select your icon on the button and select “OnMouseButtonDown” instead of the standard BIND!


You really solved my problem.


YOU SAVED ME, dude everyone across the internet is saying drag and drop stopped working in ue4 and its a glitch, but its literally not, you literally just solved this for me, thank you sooo much


the same code is working in ccgtoolkit,but when I try to use this logic in my project ,it’s not working

I had to override OnPreviewMouseButtonDown with DetectedDragIfPressed. Took me a while to figure this out so hopefully this helps someone else :slight_smile:


Thanks a lot @flippyflops.l7d !! You save my day!! :vulcan_salute:

1 Like