Value cannot be Null

Im also havign an issue with my saving system where it isnt saving my saving Inventory / Equipment properly, i rewatched the videos in the Inventory course on them, but im unsure what i was doing wrong. My error im getting (only when i load) is " ArgumentNullException: Value cannot be null" and it points to this section of the code

One of your inventory items does not have it’s itemID set…
I used to instruct users to open each inventory item (after which the code will create an inventory item, and you won’t even know which item was missing one). Try this to direct you to the correct item:
Just before the if(ItemLookupCache line, add this bit of debug code (after the {

              if (item.itemID == null)
                    {
                        Debug.Log($"{item.name} does not have an itemID");
                        continue;
                    }

This should tell you which items need to be opened. The mere act of opening the items should fix the error as the ISerializationCallbackReceiver should do the rest.

Additional tip: When bringing code into the forums, copy and paste the code, then highlight the code and press the </> button to format it. Especially with longer snippets it will be much easier to read, even on mobile.

awesome this helped out, thankyou

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

Privacy & Terms