UIS Save System Loading

siendel

New member
It seems the first time I start my main world scene in the editor after starting Unity, I get an error in the InventoryBridgeSaver.cs function DeserialzeAndLoadSaveData function - specifically, the TryGetValue shown below fails and the warning message shows up (plus those items are screwed up in my inventory). It generally seems 2 or 3 items get this error, but the other items are all found (and equipped if flagged).

if (InventorySystemManager.ItemRegister.TryGetValue(itemIDAmounts[j].ID, out var item) == false) {
Debug.LogWarning($"Saved Item ID {itemIDAmounts[j].ID} could not be retrieved from the Inventory System Manager.");

This does not seem to happen if I start from my start menu scene first, or for future restarts of my main scene. I'm guessing the Inventory System Manager component must not be fully initialized at the time this is called. But I didn't see anyone else reporting this issue so I'm a bit perplexed; any ideas?

EDIT: Never mind, I disabled the load on Application Start checkbox and left the Load on Scene Loaded checked. That seems to have fixed the issue above and sort of makes sense why having both was causing the issue I had. Leaving this just in case someone else runs into the same problem.

As an aside, I've noted that when I load in from my start menu scene, my equipped weapon becomes unequipped. I'm not sure why, as my clothing items stay equipped and I have that code running before the restoration of the UCC active item sets (within the same function). It stays equipped if I restart the scene (in the editor) though.
 
Last edited:

Sangemdoko

Moderator
Staff member
As an aside, I've noted that when I load in from my start menu scene, my equipped weapon becomes unequipped. I'm not sure why, as my clothing items stay equipped and I have that code running before the restoration of the UCC active item sets (within the same function). It stays equipped if I restart the scene (in the editor) though.

I'm not sure why this would happen. But just to be sure you aren't using both an InventorySaver and a InventoryBridgeSaver on the same component right? There should only be the InventoryBridgeSaver
 

siendel

New member
I've doubled checked and just using the one saver. Not really worried about it, in most cases I think I actually want it to be this way. In any event there are several ways I can go about correcting this if it turns out I need to later.
 
Top