Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UMG Drag&Drop: A little help ?

Hello there fine folks of Epic :) I've downloaded the 4.5 preview from 09/09 and eagerly went about exploring. Its looking great and I'm excited for a stable build in the future.

One of the things that I'm interested in learning a little more about is the drag-drop functionality that you guys have been working on. As there's no documentation on this fresh feature just yet, could someone tell me what the current workflow is ? I'd love to play about with it :)

Best Regards and Much Love MrNexy

Product Version: Not Selected
more ▼

asked Sep 14 '14 at 09:52 AM in Blueprint Scripting

avatar image

139 14 15 19

avatar image eXi Sep 14 '14 at 10:00 AM

Hey Nexy, where did you find the 4.5 preview or better, where did you find the patchnotes? :O

avatar image MrNexy Sep 14 '14 at 10:02 AM

Its on the Github, I'm calling it 4.5 preview because that's the version the editor displays starting up. I've been looking through the commit log :3

avatar image eXi Sep 14 '14 at 10:03 AM

Ah, need to have a look at Github more often. Thanks mate, see you on the forums. (:

avatar image newbprofi Sep 25 '14 at 12:36 PM

i want to know about UMG drag&drop too.

avatar image FS Creations Oct 06 '14 at 11:43 PM

Hi everyone -- I'm still having a hard time trying to figure this out. Is there any documentation on how to achieve a simple drag & drop effect? I went through Chooka's answer but I wasn't able to get anything at all.

avatar image eXi Oct 07 '14 at 08:12 AM

As it seems, Nexy used the canvas for this. Same to me, because we don't know how the Drag and Drop in UMG works (if it is implemented now).

If you want to make this with the Normal HUD you need a bit work, but it's not that hard.

I used hitboxes that i named from 0 to (letss say) 35. So i have 36 inventory places. Let's say i have 6 rows with 6 inventory places each.

So the first row has hitboxes with the names 0 - 5. If you click on a hitbox, you get the name of the clicked hitbox. I used this "name" as the index to check my inventory. Your inventory should be set up already.

So i made 2 extra arrays. Both for the x and y value of each item icon.

When i create the hitboxes, i also save the positions inside these 2 arrays. The first one always stays the same, the second one is used to draw the item icon and move it later.

So, you are not actualy moving the item, but more the icon and only change it's place if you moved it to another hitbox.

Now if you click on a hitbox, you check your inventory, if there is an item in it at this place (take the hitbox name and use a Get Node for your inventory array). If yes, you update the position of this icon with your mouse position until certain events happen. I used the second array to get the positions where i want to draw my icons. So i update the Hitboxname position in this array to my mouse position. If i want to reset this position, i use the first array to get the original posititions back.

That's the overall idea...

You would than need to think about different behaviour, like what happens if i let go of my mouse, while holding an item and there is already an item:

Do i switch these items? Or can i maybe stack the item ontop?

And so on. Took some time to get everything run, but i guess that's how you do a drag and drop system in the canvas.

I wanted to make a Marketplace Project of this inventory, but don't know if i may sell something like this. Still no Staff answer.

avatar image FS Creations Oct 09 '14 at 12:04 AM

That was one hell of an answer! Thanks for your insights.

avatar image Hakabane Oct 17 '14 at 12:06 AM

Just a heads up, Nick posted a really nice quick tutorial on drag and drop on the forums: https://forums.unrealengine.com/showthread.php?49644-UMG-Drag-amp-Drop-capturing-mouse-events

avatar image eXi Oct 17 '14 at 08:18 AM

Thanks for the info. Next time i update my engine i will test it. At the moment i read too many questions about bugs in the new version.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

so far i have this:

if you have a widget derived from UserWidget you can implement the 'OnMouseDown' where you can execute a 'Detect Drag if Pressed' node, which will fire off a 'On Drag Detected' event on that widget. Implement your 'On Drag Detected' and execute a 'CreateDragDropOperation' node. derive a class from UObject and use it to pass any info you want. plug it into the payload pin of the 'CreateDragDropOperation' node. Now you can just implement the 'OnDrop' on any of your UserWidgets and the payload pin will hold your payload object ready for you to cast back to your derived class and use.

more ▼

answered Sep 29 '14 at 01:13 PM

avatar image

81 2 3 4

avatar image MrNexy Sep 29 '14 at 07:07 PM

Thank you kindly Chooka :) I shall give that a go sometime. For the time being I have found a solution that works well enough (for now :3 )

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question