Drag and Drop On invisible Ui area

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?

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

image

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

it still block it

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:

  • in the PC:

image

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:

1 Like


there no other things block it
also I use sphere collision to detect mouse click

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.

1 Like

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

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…

1 Like

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

1 Like

the item just get click and add to inventory and destroy



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]

1 Like

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:

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.

1 Like

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

There’s always a workaround:


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…


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

1 Like

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

Tough Customer :wink:


  • all in the same the dragged widget:

  • parent container with previous functionality removed:

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

1 Like


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

I found another solution to this


I bind the BG to is drag and drop
so it only show when draging