Problems with Drag & Drop between Inventory window & Equipment

desukarhu

Member
Hi,

I finally started testing the new version with drag & drop and UI designer, but I'm unable to get the equipment drag & drop to work.
I created a floating Inventory window and floating Equipment window. Now immedietely when I start the game the "Inventory" field gets nulled from "Item Slot Collection View" component in the equipment window and I get the error:
Code:
The inventory 'Player (Opsive.UltimateInventorySystem.Core.InventoryCollections.Inventory)' does not contain an item slot collection for the ID provided in the ItemSlotCollectionView
UnityEngine.Debug:LogError(Object, Object)
Opsive.UltimateInventorySystem.UI.Panels.Hotbar.ItemSlotCollectionView:OnInventoryChanged(Inventory, Inventory) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/Hotbar/ItemSlotCollectionView.cs:141)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotsContainerBase:SetInventory(Inventory, Boolean) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlotsContainerBase.cs:283)
(The inventory DOES contain an item slot collection with the same ID as specified)

When I add the inventory again in the inspector during runtime and open the equipment window again the error changes to:
Code:
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateInventorySystem.Core.InventoryCollections.ItemSlotCollection.GetItemStackAtSlot (System.Int32 slotIndex) (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/InventoryCollections/ItemSlotCollection.cs:96)

And if I try to drag an item from my inventory window to the equipment window I get the same error as above and the dragged item gets removed.

What am I doing wrong?


Edit: Fixed it, dumb error. Anyone else gets this error: Make sure the equipment collection is ItemSLOTCollection, not just ItemCollection.
 
Yes the ItemCollection MUST be an ItemSlotCollection AND it has to reference the same ItemSlotSet scriptable object as the UI.
I'm glad you found the solution on your own
 
Top