I have set up an inventory container for my player and a menu screen using the inventory container (slots) menu part. It appears as follows:

image

My goal is to be able to rearrange the items in the inventory as shown in the inventory container documentation. In the menu screen part I have enabled the various settings involving drag and drop, including the merge on drop checkbox (I tried different combinations of settings) but in general I guess it looks like this:

image

I have also gone through inventory settings an enabled dragging although I don't think it actually pertains to the inventory containers slots.

image

As a test I enabled the drag notification in the UI settings to see if it was registering the drag and it seems to be doing so as the UI Box I setup to appear on drag does appear and disappear; however, dragging any one slot does not do anything no matter where I let go of the dragged slot.

I noticed the inputs for the menu part are UIButtonInputs and not HUD Component Content provided UI shortcuts and I am wondering if this has anything to do with it.
I also wonder if there is a default item slot sorting setting that is preventing me from rearranging slots and sorts the items into the first available slot preventing me from rearranging, but I have had no luck finding such a setting.

I appreciate any help I can get on this matter, thanks for your time!

  • I thought I would update the post with my progress. I still can't get it to work and I am not sure what I am missing. I updated my UIIntButton to have a hud content provider component and set the UI Content (TextMeshPro) of the button to have the hud content provider selected.

    image

    And in my inventory menu screen on the inventory container menu part I have changed the assigned slot content layout to be a shortcut UI hud type.

    image

    The inventory still displays as in my first picture so the shortcut slot is populating with the item and displaying the icon properly. However I am still having no luck with drag and drop functionality
  • edited June 2022
    Which Unity version are you using?
    Unity either silently changed how the Unity UI handles pointer events or has a bug since Unity 2021.2 (or maybe even earlier). Basically, pointer enter on a child object will now cause pointer exit on it's parents, e.g. moving the cursor over an image on a shortcut slot child object will no longer recognize the shortcut slot as being hovered over, breaking everything here ...

    Next ORK update will add a fix/workaround for this.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I would like to update my post for anyone who reads this and has the same issue because of Unity LTS 2021. You were correct about how they changed how they handle pointer exits of an object and they probably did it silently too.

    I have fixed the issue thanks to this forum post here: https://forum.unity.com/threads/problem-with-ipointerenterhandler-ipointerexithandler-and-setactive.1235596/

    The post that details the fix, explains the following:

    image

    So to fix this issue I simply went into C:\Program Files\Unity\Hub\Editor\2021.3.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules

    and edited the BaseInputModule.cs file to comment out those 4 lines mentioned in the post. Now I can drag and drop items and rearrange them just fine.

    Hopefully this helps anyone while they are waiting for a work around from GIL or fix from Unity itself (unlikely probably)
  • Hi @Vanisle thanks for sharing this, it is an amazing finding!
Sign In or Register to comment.