Hi there!
I have a simple 2-d character that is currently set up to be customizable in the game.
Right now I have it set up so that playing across scenes, the customizations all stay. But when I try to save and re-load the game, the character is poped back to their base appearance.
I tried putting a multi-active saver on the player, linking to all of their parts, but I can't seem to find a way to make the save stick.
Is there a different saver script I should be using, or something else I need to add?
saving customized characters
Re: saving customized characters
Hi,
Is your character configured to survive scene changes? (e.g., is DontDestroyOnLoad called on it?) Or is there a separate instance of the character in each scene, and it uses saver component(s) to save the customization settings in the old scene and then apply those customization settings to the character instance in the new scene?
If it uses saver component(s), then generally speaking it should work the same when you save and re-load a game.
If it's not working in this case, here are some ideas to check:
- Tick the Debug checkboxes on the SaveSystem component and the saved game data storer component (e.g., PlayerPrefsSavedGameDataStorer). This might give you some insight into what's going on. In particular, if you're using PlayerPrefsSavedGameDataStorer it will report the contents of the saved game. (You can also inspect the component and click the Show button to see the contents.) It'll be a little hard to read, but you can search for the saver key(s), make sure they're present, and check their saved values.
- When you save and reload, are you perhaps using a different Dialogue Manager GameObject than when you test scene changes? (See this recent post for some info about Dialogue Managers.) If so, the Dialogue Managers might be configured differently.
- Make sure the MultiActiveSaver component is on a GameObject that starts active when the scene starts, and that it stays active at least until the saved game data is applied (typically 1 frame after Start).
If that doesn't help, please feel free to send a reproduction project to tony (at) pixelcrushers.com and include steps to reproduce the issue. I'll be happy to take a look.
Is your character configured to survive scene changes? (e.g., is DontDestroyOnLoad called on it?) Or is there a separate instance of the character in each scene, and it uses saver component(s) to save the customization settings in the old scene and then apply those customization settings to the character instance in the new scene?
If it uses saver component(s), then generally speaking it should work the same when you save and re-load a game.
If it's not working in this case, here are some ideas to check:
- Tick the Debug checkboxes on the SaveSystem component and the saved game data storer component (e.g., PlayerPrefsSavedGameDataStorer). This might give you some insight into what's going on. In particular, if you're using PlayerPrefsSavedGameDataStorer it will report the contents of the saved game. (You can also inspect the component and click the Show button to see the contents.) It'll be a little hard to read, but you can search for the saver key(s), make sure they're present, and check their saved values.
- When you save and reload, are you perhaps using a different Dialogue Manager GameObject than when you test scene changes? (See this recent post for some info about Dialogue Managers.) If so, the Dialogue Managers might be configured differently.
- Make sure the MultiActiveSaver component is on a GameObject that starts active when the scene starts, and that it stays active at least until the saved game data is applied (typically 1 frame after Start).
If that doesn't help, please feel free to send a reproduction project to tony (at) pixelcrushers.com and include steps to reproduce the issue. I'll be happy to take a look.