Drop Temporarily Breaks

cybernetsurfer7

New member
Hello,

I've got a simple scene set up that's mostly the base RPG UI scene. The one change I made was to add an item description block to the item slot equipment inventory. That all works as expected. However, I have this strange issue where sometimes after starting the scene, the drop functionality no longer works for the equipment. You can see in this first image the green highlight shows that it's working.

1642099862401.png

In this second image it only shows the yellow highlight and will not allow the drop to add the item to the equipment.
1642099900016.png

Here's a quick shot of the inventory setup.
1642099954783.png

When it fails to work, no errors or warnings are thrown. Now what's really weird is that I can consistently fix it by going in the editor scene view to the item descriptor I added to the equipment inventory and toggling the gameobject on and then off again. If I do that and then enter play mode the drag and drop will work. Any insight into what might be going on here would be great.
 
Well that's an odd one.
While you are drag and dropping open up the Unity EventSystem inspector. This is a good way to debug UI interaction because it tells you what you cursor is raycasting:
1642149442957.png
That should give you an idea of whether the issue is that something is preventing you from hovering over the ItemViewSlot or if it is something else.

The other potential problem would be something within the drop condition, although I don't see how that could not work consistantly. You can check the Debug Passed Condition, to know what was the last drop action that returned true.
1642149743440.png

The last thing to try is to go into the code and adding some Debug statements to see where it breaks. I'll try to replicate it on my end so I'll keep you up to date
 
Thanks for the quick reply! I did some investigations using the event system debugging (possibly because I'm using the new input system it doesn't show as detailed of a report as yours shows?)

This is what it shows when the drop fails:
1642180725661.png

And this is what it shows after the toggling the description trick:
1642180820904.png

Notably, they seem to be showing the same element.

With regard to the `Debug Passed Condition` in the case when it doesn't work, the value stays 0. After fixing it, the value changes to -1 and 1 as expected.

I'll have to start getting some debugging going to see if I can spot where the issue is happening. Because toggling the item display menu fixes it (albeit temporarily), I'm wondering if it's doing some kind of initialization or resetting some value. Could be a lifecycle issue.
 
With regard to the `Debug Passed Condition` in the case when it doesn't work, the value stays 0. After fixing it, the value changes to -1 and 1 as expected.
This could be a clue to what the problem could be. Perhaps there is something wrong with the condition in at index 0.

Btw I see from your screenshot that you have an error during play mode in your console. What is that error? Note that any error, even errors unrelated to the Inventory System can sometimes cause issues because it breaks the flow of execution. Make sure to fix that error before you continue to debug this issue
 
I both updated the library and fixed the bug. For context, the display item info box was missing a few references to the panel and had a size of 0,0 so the background wasn't visible. Once I fixed those things the box started working again and the error went away. I think you may be correct that the drag/drop was a byproduct of the display item box being broken. I initially didn't worry about it because I'd actually fixed that once before (unsure how it got back into the broken state, possibly I didn't ever fix it in this one, I've been creating numerous scenes to test out the various features of your library). Whether updating or fixing the display image seems to have resoled the drop problem though (my guess is the bug fix). I've started and stopped the game multiple times and drag and drop has worked consistently. If something else comes up with this I'll return to this ticket but for now that one looks fixed!
 
Top