cptscrimshaw
Member
Hi there! I've run into a weird bug I haven't been able to narrow down – I'm entirely sure I did something to introduce this issue, but it seems to be occurring throughout the Inventory system and not just in one place. Anytime I call RemoveItem, I'm getting a null reference exception on the following line of code:
I did a debug on each item in that line, and they are all coming back with results...
Here is the console log:
I'm 99.99% sure this error has nothing to do with my custom classes listed in this console log, because it's happening when I run a few very simple lines of code in other classes to remove an item from the inventory.
Any thoughts on where I should look for the issue?
Thanks so much!
C#:
if (m_Inventory != null) {
EventHandler.ExecuteEvent<ItemInfo>(m_Inventory, EventNames.c_Inventory_OnRemove_ItemInfo,
(itemInfo.Item, itemInfo.Amount, this, itemStackToRemove));
}
I did a debug on each item in that line, and they are all coming back with results...
Here is the console log:
Code:
NullReferenceException: Object reference not set to an instance of an object
Opsive.Shared.Events.EventHandler.ExecuteEvent[T1] (System.Object obj, System.String eventName, T1 arg1) (at <27da9e1afec54f2fb2a11d46a234f9df>:0)
Opsive.UltimateInventorySystem.Core.InventoryCollections.ItemCollection.RemoveInternal (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo) (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/InventoryCollections/ItemCollection.cs:598)
Opsive.UltimateInventorySystem.Core.InventoryCollections.ItemCollection.RemoveItem (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo) (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/InventoryCollections/ItemCollection.cs:678)
Opsive.UltimateInventorySystem.Core.InventoryCollections.ItemCollection.RemoveItem (Opsive.UltimateInventorySystem.Core.Item item, System.Int32 amount) (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/InventoryCollections/ItemCollection.cs:689)
Opsive.UltimateInventorySystem.Crafting.Processors.SimpleCraftingProcessor.RemoveIngredients (Opsive.UltimateInventorySystem.Core.InventoryCollections.IInventory inventory, Opsive.Shared.Utility.ListSlice`1[T] selectedIngredients) (at Assets/Opsive/UltimateInventorySystem/Scripts/Crafting/Processors/SimpleCraftingProcessor.cs:475)
Opsive.UltimateInventorySystem.Crafting.Processors.SimpleCraftingProcessorWithTime.CraftInternal (Opsive.UltimateInventorySystem.Crafting.CraftingRecipe recipe, Opsive.UltimateInventorySystem.Core.InventoryCollections.IInventory inventory, Opsive.Shared.Utility.ListSlice`1[T] selectedIngredients, System.Int32 quantity) (at Assets/Scripts/Crafting/SimpleCraftingProcessorWithTime.cs:112)
Opsive.UltimateInventorySystem.Crafting.CraftingProcessor.Craft (Opsive.UltimateInventorySystem.Crafting.CraftingRecipe recipe, Opsive.UltimateInventorySystem.Core.InventoryCollections.IInventory inventory, Opsive.Shared.Utility.ListSlice`1[T] selectedIngredients, System.Int32 quantity) (at Assets/Opsive/UltimateInventorySystem/Scripts/Crafting/CraftingProcessor.cs:139)
Opsive.UltimateInventorySystem.Crafting.CraftingProcessor.Craft (Opsive.UltimateInventorySystem.Crafting.CraftingRecipe recipe, Opsive.UltimateInventorySystem.Core.InventoryCollections.IInventory inventory, System.Int32 quantity) (at Assets/Opsive/UltimateInventorySystem/Scripts/Crafting/CraftingProcessor.cs:122)
Opsive.UltimateInventorySystem.UI.Menus.Crafting.CraftingMenu.CraftSelectedQuantity () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Menus/Crafting/CraftingMenu.cs:245)
Opsive.UltimateInventorySystem.UI.Panels.ConfirmCancelPanel.ClickedConfirm () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ConfirmCancelPanel.cs:48)
UnityEngine.Events.InvokableCall.Invoke () (at /Users/bokken/buildslave/unity/build/Runtime/Export/UnityEvent/UnityEvent.cs:180)
UnityEngine.Events.UnityEvent.Invoke () (at /Users/bokken/buildslave/unity/build/Runtime/Export/UnityEvent/UnityEvent/UnityEvent_0.cs:58)
LongClickButton.Update () (at Assets/Scripts/UI/Crafting/LongClickButton.cs:94)
I'm 99.99% sure this error has nothing to do with my custom classes listed in this console log, because it's happening when I run a few very simple lines of code in other classes to remove an item from the inventory.
Any thoughts on where I should look for the issue?
Thanks so much!