Change Save System Method

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Kamotachi
Posts: 44
Joined: Fri Nov 29, 2019 9:03 pm

Change Save System Method

Post by Kamotachi »

Hi!

I recently got my game published on Steam. I must thank this asset a lot, it obviously appears in the game credits.

The fact is that I have come across a question that I had not considered, and perhaps if it goes a little further away from the topic regarding the asset, I understand that it is not answered here.

It has to do with the save system. In my game I have the components:
- Save System
- Dialogue System Saver
-Json Data Serializer
- Player Prefs Saved Game Data Storer

At the request of some people on Steam, they want me to add the ability to save to SteamCloud.
If I'm not mistaken, to do this I simply need to know in which folder the game is saved.

I think that for the game to be saved in a folder and not in PlayerPrefs, I should change "Player Prefs Saved Game Data Storer" to "Disk Saved Game Storer", is that correct?

If so, I have another question.
If in an update I delete "Player Prefs Saved Game Data Storer" with "Disk Saved Game Storer" will it harm the game of people who are already playing? Maybe can I put both components to go more calmly?

Thanks!
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change Save System Method

Post by Tony Li »

Hi,

Congratulations on getting your game published on Steam!

You're correct; if you replace PlayerPrefsSavedGameDataStorer with DiskSavedGameDataStorer, then old players with games saved in PlayerPrefs won't be able to access their saved games.

The best approach will be to do some scripting. Here's one idea:
  • Make a subclass of DiskSavedGameDataStorer.
  • Override HasDataInSlot(). If the base.HasDataInSlot(slotNumber) returns false, check if the saved game is in PlayerPrefs by copying the code from PlayerPrefsSavedGameDataStorer.
  • Override RetrieveSavedGameData(). If the the base method returns null, try to retrieve from PlayerPrefs by copying the code from PlayerPrefsSavedGameDataStorer.
  • Override DeleteSavedGameData(). Call the base method, and then also try to delete from PlayerPrefs by copying the code.
  • Use this subclass in place of PlayerPrefsSavedGameDataStorer.
I recommend testing this thoroughly locally to make sure it all works the way you want before releasing it on Steam.
Post Reply