private void Awake() { DontDestroyOnLoad(gameObject); Instance = this; Load(); RetrieveDataForText(); Debug.Log(HelperSave.Serialize <SaveState> (state)); }
public void Load() { //is there already a save? if (PlayerPrefs.HasKey("save")) { //takes our current save state and uses helpersave to deserialize it state = HelperSave.Deserialize <SaveState> (PlayerPrefs.GetString("save")); } else { state = new SaveState(); Save(); print("No Save, making new one"); } }
//Save state of this savestate to the player prefs public void Save() { //turns our state into a string to serialize PlayerPrefs.SetString("save", HelperSave.Serialize <SaveState>(state)); }