# Drag and Drop On invisible Ui area

**URL:** <https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177>\
**Category:** UI\
**Tags:** unreal-engine, UE5-0, Widget, question, UMG\
**Created:** [October 21, 2022, 10:14am UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177 "2022-10-21T10:14:20Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pasunna\_Zacrifa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pasunna\_Zacrifa](https://forums.unrealengine.com/u/Pasunna_Zacrifa)\
**Post date:** [October 21, 2022, 10:14am UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/1 "2022-10-21T10:14:20Z")

</div>

I make a drag and drop inventory  
problem is it is a mouse base game  
So I want the mouse to click and collect actor from the world while open inventory  
but the drop function doesn’t detect drag operation if the widget not fill out the screen  
and if I make some visible fill out the screen  
the mouse can’t click on actor because inventory widget block it  
are there solution from this?

---

<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:** [October 21, 2022, 10:20am UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/2 "2022-10-21T10:20:42Z")

</div>

- ensure the widget we’re dropping on has at least one `Visible` element
- override **both** `onMouseButtonDown` and `onMouseButtonUp` but pass `Unhandled’.

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/e/1/ce16d1e66dc1c988b16e04430dc62d5c5cc59361.png)

This should allow you to detect clicks (from onDrop and others) and then pass the input to the Player Controller.

---

<div class="post-metadata">

**Author:** ![Pasunna\_Zacrifa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pasunna\_Zacrifa](https://forums.unrealengine.com/u/Pasunna_Zacrifa)\
**Post date:** [October 21, 2022, 10:26am UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/3 "2022-10-21T10:26:32Z")

</div>

it still block it

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/f/e/0fe6472e374753032b26b479d9891fdf1c1a56e8.png)

---

<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:** [October 21, 2022, 10:28am UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/4 "2022-10-21T10:28:15Z")

</div>

You may have something else block it then. Have a look at the widget reflector perhaps? There might be something in the way eating input.

* * *

to clarify:

- in the widget:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/6/a/16adabf7723624bc57ab81e7ac679aeb574c30bf.png)

- in the PC:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/5/b/35baddd07e5f6db4e0cf3a8a1fde01338fbc0496.png)

Clicking this widget prints both messages.

* * *

> So I want the mouse to click and collect actor from the world while open inventory

Maybe there’s a misunderstanding of sorts. Just to make sure we’re on the same page, you’re trying to _click through_ the inventory, right? So I have the inventory open but I want to collect the big box _behind_ it:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/7/6/e76d93c002723c3634b731329e9053771a9508df.jpeg)

---

<div class="post-metadata">

**Author:** ![Pasunna\_Zacrifa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pasunna\_Zacrifa](https://forums.unrealengine.com/u/Pasunna_Zacrifa)\
**Post date:** [October 21, 2022, 12:29pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/5 "2022-10-21T12:29:39Z")

</div>

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/d/7cdcc75721000f3db95dc58868a024c45a4bd583.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/d/7cdcc75721000f3db95dc58868a024c45a4bd583.mp4)
  
there no other things block it  
also I use sphere collision to detect mouse click

---

<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:** [October 21, 2022, 12:33pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/6 "2022-10-21T12:33:15Z")

</div>

> [@Pasunna\_Zacrifa](#):
>
> I make a drag and drop inventory

I am a bit confused - where does the drag & drop come into play?! We are just clicking here?

> there no other things block it

Did you run the widget reflector to find that out?

But the widget is not even in the way… So what else is going on? Are you switching to `UI Only Input Mode` or something? Which blueprint prints the click? This seems to have little to do with widgets if the PC gets the click (the printed message)… If in doubt, show more script please.

---

<div class="post-metadata">

**Author:** ![Pasunna\_Zacrifa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pasunna\_Zacrifa](https://forums.unrealengine.com/u/Pasunna_Zacrifa)\
**Post date:** [October 21, 2022, 12:36pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/7 "2022-10-21T12:36:07Z")

</div>

I didn’t show the drag and drop part because it’s not the problem  
the problem is when use drop function  
it need the widget to has some element fill the screen to detect it  
and it blocking the item clicking

the widget I fill screen is transparent

for reflector I will watch some tutorial and report back

---

<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:** [October 21, 2022, 12:40pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/8 "2022-10-21T12:40:17Z")

</div>

Nothing we can do without seeing the script and the setup.

You’re taking about somethig that works out of the box currently not working.

Run the reflector. What do you hit when the click happens? Why do we see the message when you click yet things do not work?

There’s no way anyone can just guess that…

---

<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:** [October 21, 2022, 12:41pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/9 "2022-10-21T12:41:43Z")

</div>

> [@Pasunna\_Zacrifa](#):
>
> for reflector I will watch some tutorial and report back

The docs are somewhat convoluted, here’s a crash course in a single pic:

> [@Adding child widgets, only some elements show up?](https://forums.unrealengine.com/t/adding-child-widgets-only-some-elements-show-up/500986/4):
>
> A double-check list: text is Visible text is not fully transparent no funky business in Init / (Pre)Construct search for the Text Block references in all blueprints (the binoculars) and see if another blueprint fiddles with it If the abovementioned sanity check is satisfactory, use the [Widget Reflector](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Slate/WidgetReflector/) and see what is happening to the misbehaving Text Block: A crash course on Reflector:

---

<div class="post-metadata">

**Author:** ![Pasunna\_Zacrifa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pasunna\_Zacrifa](https://forums.unrealengine.com/u/Pasunna_Zacrifa)\
**Post date:** [October 21, 2022, 12:57pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/10 "2022-10-21T12:57:52Z")

</div>

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/0/3/c036c1848f1e779772c7d3c3b06c0ac07fd3bad5.jpeg "Unreal Engine 5 2022 10 21 19 48 22 02") ](https://www.youtube.com/watch?v=E30NnvWNF_A)

the item just get click and add to inventory and destroy

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/f/f8f715e43c4644f459571f3c573e864c7b9698e6.png)  

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/c/63c44977e358f2bfe5a56d243e9de417b23bdcd6.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/c/63c44977e358f2bfe5a56d243e9de417b23bdcd6.mp4)
  
and this is when I set the background to detected the drop out of screen[hidden]  
the item click work  
but the drop not work  
[in first video the drop out of widget item will spawn]  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/7/b/17b1c7d44ab7040f68bf402854b11c86e885508c.png)

---

<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:** [October 21, 2022, 1:22pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/11 "2022-10-21T13:22:49Z")

</div>

Ok, so this is not _really_ drag & drop. Drag and drop is for dropping stuff onto other widgets, when the drop is detected by a widget’s onDrop implementation.

I believe what you’re looking for is `OnDragCancelled` since we’re dropping into the _world_, rather than detecting another widget container, right? Something like this:

> [@Spawning an object on "On Drag Cancelled"... spawns in weird locations](https://forums.unrealengine.com/t/spawning-an-object-on-on-drag-cancelled-spawns-in-weird-locations/253644/3):
>
> Before you evaluate / attempt to fiddle with the above, try this: Untested and 99% sure it’s not going to work…

The above would be implemented in the Drag Operation itself.

* * *

In short: the `onDrop` does not work if there’s no widget to drop onto.

---

<div class="post-metadata">

**Author:** ![Pasunna\_Zacrifa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pasunna\_Zacrifa](https://forums.unrealengine.com/u/Pasunna_Zacrifa)\
**Post date:** [October 21, 2022, 1:41pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/12 "2022-10-21T13:41:01Z")

</div>

nope ondrag cancel only work if drag not complete like release button too fast  
but this is drag and drop out of widget box so it long and On Drag cancel just not in focus anymore  
anyway if there are no work around I will just make little drop point Ui in widget  
it’s not worth the time that much to investigate more  
Thank you for your help

---

<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:** [October 21, 2022, 1:44pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/13 "2022-10-21T13:44:31Z")

</div>

There’s always a workaround:

> [@Getting Mouse Position During Drag and Drop UMG](https://forums.unrealengine.com/t/getting-mouse-position-during-drag-and-drop-umg/85760/15):
>
> Because it's undocumented, arcane knowledge obtainable only by those knowing a secret handshake. The below assumes you have overridden and using a Game Mode, a Player Controller and created a custom Drag & Drop Operation. in the Player Controller A Custom Event converts screen space to world space via deprojection and sets actor’s position: in the Custom Drag & Drop Operation blueprint Event Dragged spits out screen space coordinates and feeds them to an Event Dispatcher, we…

* * *

> nope ondrag cancel only work if drag not complete like release button too fast

This is not true. Even if I implement the drag cancelled in the widget that detected the drag, it works just fine…

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/f/c8ff64ff9ada8815ab5e8df01bbd703f3f2f1915.png)

* * *

If you can’t replicate this, consider putting breakpoints where it makes sense and step through the script.

---

<div class="post-metadata">

**Author:** ![Pasunna\_Zacrifa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pasunna\_Zacrifa](https://forums.unrealengine.com/u/Pasunna_Zacrifa)\
**Post date:** [October 21, 2022, 4:25pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/14 "2022-10-21T16:25:15Z")

</div>

Thing is my on drag is not happened in the top widget  
it happens on children widget[the gun etc item in canvas container]  
and I follow some tutorial with specific setting that I don’t really understand it well

so at this point I can’t explain what exactly is the problem between child drag communicate with parent because drag cancel on main widget just not fire at all and the canvas container also not

main widget \> Grid Container widget\> Item widget[drag happen here]  
I will keep your suggestion and find out more if I understand it better  
thanks

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/7/a/87abc3637c50050487730373262bed8a52f27c06.jpeg "Unreal Engine - Spatial Inventory Tutorial (4/4)") ](https://www.youtube.com/watch?v=4NpcisVVhr0)

---

<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:** [October 21, 2022, 4:41pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/15 "2022-10-21T16:41:19Z")

</div>

**Tough Customer** 😉

* * *

- all in the same the dragged widget:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/b/3/6b364fec1e5bc9c918615f51155b20507907b63f.png)

- parent container with previous functionality removed:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/2/9/62941511db5b5829be2cc7db7eb30afa94ec2ac7.png)

Dragging those widget and dropping them outside of any other widget (viewport):

---

<div class="post-metadata">

**Author:** ![Pasunna\_Zacrifa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pasunna\_Zacrifa](https://forums.unrealengine.com/u/Pasunna_Zacrifa)\
**Post date:** [October 21, 2022, 4:51pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/16 "2022-10-21T16:51:21Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/5/d/15db2ec402bb02765d7f01eaf7c4edc903939a10.png)  
the item is in backpack widget  
and the drag happen there  
more like this  
Main

- container widget
  - item widget[drag happen hear]

and he also removed it from parent like this

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/6/d/16ded62d7b9334cbca261b3cd6262a63488eac7f.png)

---

<div class="post-metadata">

**Author:** ![Pasunna\_Zacrifa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pasunna\_Zacrifa](https://forums.unrealengine.com/u/Pasunna_Zacrifa)\
**Post date:** [October 21, 2022, 5:39pm UTC](https://forums.unrealengine.com/t/drag-and-drop-on-invisible-ui-area/674177/17 "2022-10-21T17:39:33Z")

</div>

I found another solution to this

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/7/3b70ee6a87b60215f9bbd511aa1a1d2eb5149803.png)  
I bind the BG to is drag and drop  
so it only show when draging
