Keeping Items and currency on scene transitions

Farcaster

New member
I've looked through the documentation but still haven't been able to get my player's inventory to be saved upon scene transitions. The method I am using is the naive method in which each scene has its own inventory UI and save manager. I made sure to add the inventory saver and currency saver to the player
1640542533365.png
I also made sure to tick save on destroy and load on start for both savers in the scene I am leaving and the scene I am going to. I also made sure that there is a Save System Manager and Inventory System Manager Item Saver in both scenes and the Auto Load on Scene Loaded, Auto Save on Scene Unloaded and Save on Destroy, and load On Start are all ticked.
1640542702387.png
This is true for both the scene I am leaving and the scene I am transitioning to. But even so, I can't get the player's inventory to save.
 
@Sangemdoko is on vacation this week but normally to persist objects across scenes you use DontDestroyOnLoad. If that doesn't work Sangemdoko will respond when he gets back.
 
As Justin mentioned, you'll want to use DontDestroyOnLoad for the managers of the inventory system, That includes the Ultimate Inventory System Manager, Save System Manager, etc...

Even though Auto Load On Scene Loaded and Auto Save On Scene Unloaded are options, it is always better to save and load the game manually. There are many reasons for that, one of them is that Unity destroys items in a "random" order, so you cannot really predict what is getting saved and then.

If I were you I would simply call the SaveSystem.Save() and SaveSystem.Load() functions before and after loading a scene.
Learn more here:
and here:

I'm on vavation until the 3rd so support is a bit slower than usual, but not for long :)
 
Top