To save only the Opsive player state and position:
1. Set up a Save System GameObject with these components: SaveSystem, JsonDataSerializer, and PlayerPrefsSavedGameDataStorer.
- Options: You can use BinaryDataSerializer or your own DataSerializer subclass instead of JsonDataSerializer, and DiskSavedGameDataStorer or your own SavedGameDataStorer subclass instead of PlayerPrefsSavedGameDataStorer. The saved game data storer won't be used; it just silences a warning from the Save System about not having a SavedGameDataStorer.
3. Add a UCCSaver component to the player. Tick the options you want to save. Do not add any other saver components to any other GameObjects unless you want the Save System to save their info, too.
4. To save the player's data to a string:
Code: Select all
using PixelCrushers;
...
string s = SaveSystem.Serialize(SaveSystem.RecordSavedGameData());
5. To restore the player's data:
Code: Select all
SaveSystem.ApplySavedGameData(SaveSystem.Deserialize<SavedGameData>(s));