Drag not working for equipment UI

popystone

New member
I've duplicated the RPG inventory UI and spawned it into my scene. I have done all the necessary changes to make sure the inventory works with my player.

I can do drag and drop in the inventory UI, but when I try to drag and drop in the equipment UI, it doesn't work. The drag don't even get started. I put a debug in the HandleItemViewSlotBeginDrag method of ItemViewSlotDragHandler class and when I drag in the equipment UI, the log don't print but when I drag in the inventory UI the log is printed.

Link to discussion on discord: https://discord.com/channels/476506682382483456/760110372035493928/850088526849900614

I tried to add an equipment in the UIS demo scene then drag on the existing equipment in the demo scene also stop working.

Screenshot of the equipment panel:

Equipment Panel.PNG

Screenshot of equipment Itemview Slot Container:
Equipment Itemview Slot Container.PNG

Video:
 

Sangemdoko

Moderator
Staff member
That's a weird issue.

First thing I would like you to check is if at runtime, after you open the Equipment UI are these two fields circled in blue assigned?
1623052512246.png

If that's the case then it would confirm that your UI is initialized correctly.

If that's the case then the second thing I would like you to check is the Item View Slots for your Equipment. Especially the Canvas Group and the Item View Slot options, make sure they are set to be interactable.
1623052732381.png


If both of those are working correctly, I would suggest you add more Debug.Logs to see at which points it fails.
Start with the "Action Button" script (the base class of the Item View Slot). There is an "OnBeginDrag" function which sends the original event.

If the debug there works, it means the issue is either with the Item View Slot Container or the Drag Handler. Otherwise the issue is that something is blocking the interaction with the selectable object.
 

popystone

New member
I have tested and all fields in inspector are assigned as expected. I added debug in the "OnBeginDrag" function as suggested and the log are being printed onto the console.

I have Item Action Panel for the equipment UI but when i click on the equipped item slot the action panel doesn't show but it shows for inventory.
 

Sangemdoko

Moderator
Staff member
Ok so the Item View Slots do receive the interaction events, but it would appear the Item View Slot Container does not...
Just to be sure please add a Debug.Log at each step to know exactly where the issue is.

So the first one was the ActionButton which you already added

Then in the ItemViewSlotContainerBase class, in the Initialize function there is a segment that looks like this:
Code:
itemViewSlot.OnBeginDragE += (pointerEventData) =>
{
    if (m_ItemViewSlotDragEventData.PointerEventData != null) {
        //The drop event is being used, so it cannot be used again until the drag ends.
        return;
    }

    m_ItemViewSlotDragEventData.SetValues(this, localIndex);
    m_ItemViewSlotDragEventData.PointerEventData = pointerEventData;
    OnItemViewSlotBeginDragE?.Invoke(m_ItemViewSlotDragEventData);
};
Add two Debugs one at the start, another at the end of that lambda function.

Then in the ItemViewSlotDragHandler add two Debug.Logs in the HandleItemViewSlotBeginDrag function one at the start and one at the end.


If the issue is in the ItemViewSlotContainerBase like I presume, the debug.logs won't print at all.
If that's the case add more Debug.Logs in the Initialize function of the ItemViewSlotContainer to know if it is being initialized and to know the count of itemViewSlots and if any ItemViewSlot is null.

That should narrow down the issue quite a bit.

If I can't figure out what the issue is by the end of the week, I will suggest that you send your project to support@opsive.com such that I can investigate myself.
 

popystone

New member
I have tried your suggestions and it seems the equipment ItemViewSlotsContainer is not being initialized. and the begin drag event is not triggered for ItemViewSlotsContainer and ItemViewSlotDragHandler

This even happen with the demo scene included with the inventory system. If i open the demo scene without touching the inventory UI object then everything is fine but if i touch the inventory UI and expand or select the game object then i get this behaviour where the equipment is not initialized
 
Last edited:
Top