Inventory and equipment not being restored

Hey guys,
I’m having another bug with the save system, my inventory and equipment are not being restored when I load the save. I get an error at runtime and couldn’t find the reason for that.
My code can be found in https://github.com/renanpll/SciFi

The error is:
ArgumentNullException: Value cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary2[TKey,TValue].FindEntry (TKey key) (at <437ba245d8404784b9fbab9b439ac908>:0) System.Collections.Generic.Dictionary2[TKey,TValue].ContainsKey (TKey key) (at <437ba245d8404784b9fbab9b439ac908>:0)
GameDevTV.Inventories.InventoryItem.GetFromID (System.String itemID) (at Assets/Asset Packs/GameDev.tv Assets/Scripts/Inventories/InventoryItem.cs:53)
GameDevTV.Inventories.Inventory.SciFi.Saving.ISaveable.RestoreState (System.Object state) (at Assets/Asset Packs/GameDev.tv Assets/Scripts/Inventories/Inventory.cs:248)
SciFi.Saving.SaveableEntity.RestoreState (System.Object state) (at Assets/Scripts/Saving/SaveableEntity.cs:60)
SciFi.Saving.SavingSystem.RestoreState (System.Collections.Generic.Dictionary`2[TKey,TValue] state) (at Assets/Scripts/Saving/SavingSystem.cs:95)
SciFi.Saving.SavingSystem.Load (System.String saveFile) (at Assets/Scripts/Saving/SavingSystem.cs:37)
SciFi.SceneManagement.SavingWrapper.Load () (at Assets/Scripts/Scene Management/SavingWrapper.cs:44)
SciFi.SceneManagement.SavingWrapper.Update () (at Assets/Scripts/Scene Management/SavingWrapper.cs:33)

Solved, for some reason one of my weapons were returning null in the Item ID, I solved deleting the scriptable object and creating a new one, not sure what was the cause of it

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms