Drag and Drop creating duped Item View For Grid(Clone)

Bernkastel

Member
I have a basic inventory with two items. I use the wizard and do a default setup of the cursor manager, drop manager, drag and drop manager, and move cursor. I set the Move Item Action Set to unbind when moving for the Item View Slot Move Cursor

Two issues occur, firstly when trying to use a single click and move without an action panel, the first click on an item view slot does nothing, and the second click activates the on click action to move the item to another section of the inventory. I thought that perhaps that panel wasn't actually selected so I set it to default select the first item view slot to be selected on open and still nothing, the first left click always does nothing and then they move properly.

The second issue is that when dragging and dropping, the Item View For Grid(Clone) is getting dupped and just becomes stuck as shown below (I should only have two inventory items, but two extras are currently in my hierarchy). The one used by the drag handler, If I specifically drag the item in the corners of the inventory grid and let go, it will get stuck inbetween them fairly often. In order to fix this I reduced the cell spacing to 0 but it still seems to happen often. I followed the youtube series exactly for the move/drag/drop functionality but am still running into both of these issues despite destroying the entire inventory and starting again from scratch so it should be reproduceable. I also tried leaving the category item view set for the Cursor Manager null instead of as a category item view set for grid

1610604000180.png



1610604019777.png


1610604114475.png
 
I had never noticed those bugs before... I was able to replicate both of them after trying for a few minutes.
Thank you for reporting it with a detailed explanation.

My initial thought for the second bug is that both the click and the drag move overlap, which puts the Cursor Manager in a wrong state. It doesn't know if you were trying to drag or if you were trying to move with the Item Action. I'll look into a way to make one have priority over the other (or maybe first come first served)

The first bug is probably unrelated it has something to do with item view slot selection.

I will add them to my list of bugs to fix, hopefully I can fix those before the next update.
If the fix is simple I'll send you the code changes here so you won't have to wait.
 
Last edited:
I was able to fix both bugs. It required small changes but in a few scripts, I think it's better if you wait for the next update instead of me guiding you to the scripts that need to be changed.

The first bug was caused by the container which made the selected slot null when a non-selected item view slot was deselected. This was caused by a pointer exit event, I'm still not 100% sure why that pointer exit event was ever called in the first place... my only guess is that Unity fired that event while the UI was drawing.

The second bug was just like I predicted. I fixed it by checking if the Cursor manager was being used by adding a CanMove function. Now before I move I check if the cursor manager is ready to be used
 
I'm fine with waiting, I'll just explore other aspects of the inventory for the time being. Thanks for the quick response.
 
Top