# Drag widget and drop on actor.

**URL:** <https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023>\
**Category:** UI\
**Tags:** drop, actor, unreal-engine, mouse-event, Widget, question\
**Created:** [April 11, 2019, 6:46am UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023 "2019-04-11T06:46:52Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Two-faced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Two-faced](https://forums.unrealengine.com/u/Two-faced)\
**Post date:** [April 11, 2019, 6:46am UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/1 "2019-04-11T06:46:52Z")

</div>

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](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?

 ![273898-2019-04-11-13-57-07.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/b/4fb1aedd0bfa9b574b77662d55c79144538a96a2.png)

---

<div class="post-metadata">

**Author:** ![HarryHighDef](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HarryHighDef](https://forums.unrealengine.com/u/HarryHighDef)\
**Post date:** [April 11, 2019, 9:25am UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/2 "2019-04-11T09:25:11Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Mint\_Gorillaz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mint\_Gorillaz](https://forums.unrealengine.com/u/Mint_Gorillaz)\
**Post date:** [April 11, 2019, 11:10am UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/3 "2019-04-11T11:10:42Z")

</div>

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/1/3b18794bfc5dd6e030f2a1e88e1a1d64a1ef436e.jpeg "HTF do I? Drag and Drop: The Basics ( UE4 )") ](https://www.youtube.com/watch?v=WfF3fb0WaoY)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 11, 2019, 11:52am UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/4 "2019-04-11T11:52:18Z")

</div>

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](https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/110205-getting-mouse-position-during-drag-and-drop-umg?p=1513750#post1513750).

---

<div class="post-metadata">

**Author:** ![Two-faced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Two-faced](https://forums.unrealengine.com/u/Two-faced)\
**Post date:** [April 11, 2019, 11:59pm UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/5 "2019-04-11T23:59:27Z")

</div>

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

What do you mean?

---

<div class="post-metadata">

**Author:** ![Two-faced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Two-faced](https://forums.unrealengine.com/u/Two-faced)\
**Post date:** [April 12, 2019, 12:04am UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/6 "2019-04-12T00:04:55Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Two-faced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Two-faced](https://forums.unrealengine.com/u/Two-faced)\
**Post date:** [April 12, 2019, 12:15am UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/7 "2019-04-12T00:15:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 12, 2019, 7:04am UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/8 "2019-04-12T07:04:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Two-faced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Two-faced](https://forums.unrealengine.com/u/Two-faced)\
**Post date:** [April 12, 2019, 9:09pm UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/9 "2019-04-12T21:09:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 12, 2019, 11:04pm UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/10 "2019-04-12T23:04:11Z")

</div>

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_. 😑

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 😑

* * *

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/a/d/aadbbf7b0ad4ce8ec5e012110f084abec697565b.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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 12, 2019, 11:24pm UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/11 "2019-04-12T23:24:59Z")

</div>

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:

 ![274038-dd.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/5/7/a577e69b6a00a19822a6c63f1c0d561e05927040.png)

Detecting Drag:

 ![274039-detectdrag.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/b/eab3d8f4db18beee5a3c716ef71b79f40fb11195.png)

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

 ![274037-pc.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/d/a7dbedc0e4cec4eed168ffae029c05308aaa14f4.png)

---

<div class="post-metadata">

**Author:** ![Two-faced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Two-faced](https://forums.unrealengine.com/u/Two-faced)\
**Post date:** [April 13, 2019, 3:14am UTC](https://forums.unrealengine.com/t/drag-widget-and-drop-on-actor/447023/12 "2019-04-13T03:14:34Z")

</div>

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