ok, now I don’t know what to do, how do I get the index of the slot I want to replace and change it? inside the widget and the inventory, inside the widget I don’t know what to do, and inside the inventory i’m trying this:
hi,I didn’t read through the code.
arrays have a “swap” node.which asks you to provide two indexes.
after swapping the items.you can refresh the ui elements that represent the array(basically re-initialize themselves agin).
I hope it somewhat helps you figure it out
It’s at the “on drop” function.this function is unique.
when you drop the item to one of those slots.the slot who received the dropping will call its own “on drop” function.then in the function you can get the index the slot contained.
I managed to get the index but now I’m having this problem with index 1 to 0, all the other indexes I can swap normally on them, but from 1 to 1 it doesn’t work, it keeps returning 1 in the on drop when I drop it on index 0
All right let’s debug.
The update widget and the dropping seem to be okay.
First in the drag detection.try not to use self as a visual parameter when creating the drag operation.you can create a new widget with the same look but without any collision.and then use that widget created for the visual.
because “self widget” has collision.and when you drag it ,it also able to receive dropping too sometimes if it has collision.