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.