Saving different inventories to seperate files

riquid

New member
Hi there.
I'm making a game where I move back and forth between multiple scenes. Some gameobjects with inventories will exist in multiple scenes. Other gameobjects will exist in only one scene but still need the info for their inventories to be able to be saved and loaded.
To accomplish this, I need to save the inventories of some gameobjects into one file and some into another file.

For example:
load into scene 1. Hit save game button.
Chest 1 inventory is saved to file 1.
Chest 2 inventory is saved to file 2.

load into scene 2.
load chest 1 inventory from file 1.
chest 2 does not exist in this scene.
do some stuff.
save chest 1 inventory to file 1.

load back into scene 1.
load chest 1 inventory from file 1.
load chest 2 inventory from file 2.

Does anyone have any idea how I would go about accomplishing this? Do I need to write a custom SaveSystemManager component?
 
Oh... I'm afraid you will need to write a custom Saver or save system manager for that.

If you make a custom saver component you could save both states in a single file.

The main complication with having two files is the item IDs. All mutable items are saved in one place, then the Inventories only save the IDs.
So having two save files will cause problems since you would have two sets of mutable item IDs that could potentially overlap/clash.

So I would highly recommend having a single save file but that saves multiple states of items. If if an item is different in both states then it has a different ID.

So a good place to start would be to copy paste the InventorySaver script and tweak it to your liking.
Let me know if you need some pointers on anything
 
Top