I am having problems with saving and loading when I go back and forth between scenes.

So, I have a player object, and I have created code to save and load his level, health and location when I hit the save or load buttons. I also have it set to DontDestroyOnLoad so when I switch scenes I don’t lose it’s information. I have 2 scenes currently, and in the first scene I can move it around and increment its health and level and then hit save and it saves it perfectly fine and I can load it perfectly fine. I can then switch to my other scene which is my main menu and my player doesn’t get destroyed like I had intended. I can then switch back to my first scene and my player loads in fine, because it was not destroyed. My problem is that once I switch back to my first scene save and load won’t work.

If you are not destroying your player only because of data lose. Then it will be good to use PlayPref for saving and loading data.

So may you can look into below link like how to save and load data from PlayPref.


Hope this will help you.