Cross Inventory Drag & Drop not working

r@t

New member
Hey, having issues dragging equipment to the equip slot of a different inventory. Unclear on how many components are used to make things work.

Player Inventory + Dynamic

player-inventory.png

player-dynamic.png

Bank Inventory + Dynamic


bank-inventory.png

bank-dynamic.png
 

Attachments

  • 1705764946367.png
    1705764946367.png
    38.1 KB · Views: 1
Dragging from Bank to player inventory produces no debug.
no-error.png

Dragging from player inventory to bank produces debug log.
1705766017536.png

Code:
sourceItemInfo 1 Abyssal Full Helm (3331785353) || ItemCollection(Main) Main || ItemStack(1210947416)[ 1 Abyssal Full Helm (3331785353) in ItemCollection(Main) Main]
DestinationItemInfo None ItemInfo
sourceCanGive True
destinationCanGive True
sourceCanAdd False
destinationCanAdd True
sourceIsNull False
destinationIsNull True
sourceSlotCanContain True
destinationSlotCanContain True

UnityEngine.Debug:Log (object)
Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.DropActions.ItemViewDropContainerCanSmartExchangeCondition:CanDrop (Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropHandler) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/DragAndDrop/DropActions/ItemViewDropContainerSmartExchangeAction.cs:63)
Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropActionsWithConditions:CanDrop (Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropHandler) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/DragAndDrop/ItemViewSlotDropActionSet.cs:225)
Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewSlotDropActionSet:GetFirstPassingConditionIndex (Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropHandler) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/DragAndDrop/ItemViewSlotDropActionSet.cs:129)
Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropHandler:ItemViewSlotSelected (Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotEventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/DragAndDrop/ItemViewDropHandler.cs:310)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotsContainerBase/<>c__DisplayClass78_0:<Initialize>b__1 () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlotsContainerBase.cs:227)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton:OnSelect (UnityEngine.EventSystems.BaseEventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:316)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlot:OnSelect (UnityEngine.EventSystems.BaseEventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlot.cs:106)
UnityEngine.EventSystems.EventSystem:SetSelectedGameObject (UnityEngine.GameObject)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton:OnPointerEnter (UnityEngine.EventSystems.PointerEventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:207)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlot:OnPointerEnter (UnityEngine.EventSystems.PointerEventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlot.cs:169)
UnityEngine.EventSystems.EventSystem:Update () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:530)
 
On the working player inventory -> player equipment.
Code:
sourceItemInfo 1 Abyssal Chainbody (2609963923) || ItemCollection(Equipped) Equipped || ItemStack(-1927287200)[ 1 Abyssal Chainbody (2609963923) in ItemCollection(Equipped) Equipped]
DestinationItemInfo 12 Death Rune (3575815334) || ItemCollection(Main) Main || ItemStack(1452676138)[ 12 Death Rune (3575815334) in ItemCollection(Main) Main]
sourceCanGive True
destinationCanGive True
sourceCanAdd False
destinationCanAdd True
sourceIsNull False
destinationIsNull False
sourceSlotCanContain False
destinationSlotCanContain True

UnityEngine.Debug:Log (object)
Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.DropActions.ItemViewDropContainerCanSmartExchangeCondition:CanDrop (Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropHandler) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/DragAndDrop/DropActions/ItemViewDropContainerSmartExchangeAction.cs:63)
Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropActionsWithConditions:CanDrop (Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropHandler) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/DragAndDrop/ItemViewSlotDropActionSet.cs:225)
Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewSlotDropActionSet:GetFirstPassingConditionIndex (Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropHandler) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/DragAndDrop/ItemViewSlotDropActionSet.cs:129)
Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropHandler:ItemViewSlotSelected (Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotEventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/DragAndDrop/ItemViewDropHandler.cs:310)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotsContainerBase/<>c__DisplayClass78_0:<Initialize>b__1 () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlotsContainerBase.cs:227)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton:OnSelect (UnityEngine.EventSystems.BaseEventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:316)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlot:OnSelect (UnityEngine.EventSystems.BaseEventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlot.cs:106)
UnityEngine.EventSystems.EventSystem:SetSelectedGameObject (UnityEngine.GameObject)
Opsive.UltimateInventorySystem.Input.EventSystemManager:SelectInternal (UnityEngine.GameObject) (at Assets/Opsive/UltimateInventorySystem/Scripts/Input/EventSystemManager.cs:107)
Opsive.UltimateInventorySystem.Input.EventSystemManager:Select (UnityEngine.GameObject) (at Assets/Opsive/UltimateInventorySystem/Scripts/Input/EventSystemManager.cs:89)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton:Select () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:96)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotsContainerBase:SelectSlot (int) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlotsContainerBase.cs:637)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotsContainerPanelBinding:OnOpen () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotsContainerPanelBinding.cs:128)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanel:OpenInternal () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanel.cs:333)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanel:Open (Opsive.UltimateInventorySystem.UI.Panels.DisplayPanel,UnityEngine.UI.Selectable,bool) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanel.cs:273)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanelManager:OpenPanel (Opsive.UltimateInventorySystem.UI.Panels.DisplayPanel) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanelManager.cs:300)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanel:SmartOpen () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanel.cs:187)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanelSelector:SelectPanel () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanelSelector.cs:43)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanelSelector:OnPointerEnter (UnityEngine.EventSystems.PointerEventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanelSelector.cs:62)
UnityEngine.EventSystems.EventSystem:Update () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:530)

The difference appears to be here (bank debug log):

1705766277780.png

DestinationItemInfo is "None" ItemInfo on the broken one.
destinationIsNull is "True" on the broken one.
sourceSlotCanContain is "True" on the broken one.
 
Hi @aallenfx

It's not clear to me what you are saying by it's not working.
From what I understood previously the issue is that you can't drag and drop from the bank to the Equipment panel.

But none of the logs you mention above are related to that.
The first log seems to move the item from the player inventory to equip?
The second log seems to move an item from the equip to the player inventory.


Can you explain
1) what you are doing step by step
2) What the result is
3) What you expect the result to be.


Now to answer some of your questions:
What are all components associated with making it work? I'm unsure but that'd help me take screenshots for comparisons
The main component is the ItemViewDropHanlder & the ContainerCanSmartExchange function.
This will check all the restriction on whether the item can be moved or not.
1705912699513.png

Dragging from Bank to player inventory produces no debug.
That's probably because your ItemViewDropHandler on the Bank references a different ItemViewSlotDropActionConditionObject. Check that it also has one were the debug is set for the ContainerCanSmartExchange to get logs.

Remember for drag and drop you must have the Drag component and a Drop component on both ItemViewSlotsContainers.

I attached a unity scene with a working example. It is very simple, so make sure to try it out and look at how everything is setup.


If no matter what you do you can't make it work, I would recommend you try to replicate this issue in the scene I sent you, and then you send it back to me. That will make it easier for me to understand what the problem is.

Hopefully we figure this out soon, as it seems you've been stuck on this for awhile already
 

Attachments

  • 12_2 Equipping From Other Inventory.unity
    533.1 KB · Views: 1
Oh. And for good measure I added some debug lines in the smartcontainer debug thingy.

you can change it in the ItemViewDropContainerSmartExchangeAction.cs script around line 63

Code:
Debug.Log($"" +
                          $"sourceContainer {itemViewDropHandler.SourceContainer}\n" +
                          $"DestinationContainer {itemViewDropHandler.DestinationContainer}\n" +
                          $"sourceItemInfo {itemViewDropHandler.SourceItemInfo}\n" +
                          $"DestinationItemInfo {itemViewDropHandler.DestinationItemInfo}\n" +
                          $"sourceCanGive {sourceCanGive}\n" +
                          $"destinationCanGive {destinationCanGive}\n" +
                          $"sourceCanAdd {sourceCanAdd}\n" +
                          $"destinationCanAdd {destinationCanAdd}\n" +
                          $"sourceIsNull {sourceIsNull}\n" +
                          $"destinationIsNull {destinationIsNull}\n" +
                          $"sourceSlotCanContain {sourceSlotCanContain}\n" +
                          $"destinationSlotCanContain {destinationSlotCanContain}\n");
 
Yep, looks like you were right about it referencing a different one. I changed it to the same type and now it works. Originally I had two because I thought I would need it for each type, but as you mentioned smart exchange is capable so now I only need one. Thanks!

1706039932067.png

Good to go!

1706040007364.png
 
Top