Item disappearing when dropped off inventory fix?

Unfixingdock

New member
Hey i have an issue where my items disappear when dropped off my inventory is there a condition i need to add for that to just drop the item or?
 
That's very odd.

Did you setup something to drop the item when dragged out of the inventory Grid?There is a prefab called "Scene Drop Action Item View Slot" that we use in the RPG schema that allows you to drop items in the scene and spawns an item pickup. Are you using that or something similar?

By default we do not drop items when dragged out the grid, so it should simply redraw the grid on drag stop and the item should go back in its slot.
But it seems your item goes somewhere.
Does your item appear again when you open the inventory grid after closing it? In the inspector is your item still in your inventory?

Did you get any errors/warnings?

To debug this I would recommend putting a Debug.Log in the code to check where the item is going. You could add it in the AddInternal or RemoveInternal function
 
the item when i move it out goes back to its place but when u click on it it disappears and it get this.
Also where would i integrate the prefab you are talking about

Code:
NullReferenceException: Object reference not set to an instance of an object
AddHealth.CanInvokeInternal (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, Opsive.UltimateInventorySystem.ItemActions.ItemUser itemUser) (at Assets/Scripts/Attributes/AddHealth.cs:16)
Opsive.UltimateInventorySystem.ItemActions.ItemAction.CanInvokeInternal () (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/ItemActions/ItemAction.cs:41)
Opsive.UltimateInventorySystem.ItemActions.ActionElement.CanInvoke () (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/ItemActions/ActionElement.cs:63)
Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ActionPanel`1[T].OpenInternal () (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ActionPanels/ActionPanel.cs:66)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanel.Open (Opsive.UltimateInventorySystem.UI.Panels.DisplayPanel previousPanel, UnityEngine.UI.Selectable previousSelectable, System.Boolean selectDefault) (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanel.cs:249)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotsContainerItemActionBindingBase.OpenItemAction (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, System.Int32 index) (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotsContainerItemActionBindingBase.cs:264)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotsContainerItemActionBindingBase.TriggerItemAction (Opsive.UltimateInventorySystem.UI.Item.ItemViewSlot itemViewSlot) (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotsContainerItemActionBindingBase.cs:150)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotsContainerItemActionBindingBase.TriggerItemAction () (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotsContainerItemActionBindingBase.cs:123)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotsContainerItemActionBindingBase.HandleItemClicked (Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotEventData eventdata) (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotsContainerItemActionBindingBase.cs:106)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotsContainerBase+<>c__DisplayClass63_0.<Initialize>b__0 () (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlotsContainerBase.cs:203)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton.Press () (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:72)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:123)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlot.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Assets/Import Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlot.cs:188)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.1.8f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2020.1.8f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2020.1.8f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:376)
 
AddHealth is a custom script you wrote correct? You must first fix the issue in your script. If you don't understand why the error is happening in your script feel free to share it and I can point you in the right direction.

If you do not want the Item Action to be invoked on click but instead have a Item Action Panel (like in the demo scene), you can easily add one using the UI Designer Editor Window.
1619454534086.png

I hope that helps
 
yea the script is fine and functional so is the item action panel its just when i drop it and it returns back that i get that error
 
Could you show me your script and indicate line 16 where the error happens?
That might help me understand what is going on.

For the prefab "Scene Drop Action Item View Slot", I would recommend you open the "RPG Full Layout" prefab. You'll see that it is used as the background of the scene view. It is essentially just an Item View Slot with a drop handler, and it uses a drag&drop Action to drop the item in the scene.
1619507788038.png

I would highly recommend you fix the error first before you start using this prefab.
 
Top