public virtual void SaveData() { BinaryFormatter format = new BinaryFormatter(); FileStream fs = File.Create(Application.persistentDataPath + savefile); //Debug.Log(Application.persistentDataPath + savefile); TrickSave save = new TrickSave(); save.tricks = tricks; save.nextTrickToUnlockIndex = nextTrickToUnlockIndex; format.Serialize(fs, save); fs.Close(); Debug.Log("Tricks Saved"); }
public virtual bool LoadSaveData() { if (File.Exists(Application.persistentDataPath + savefile)) { BinaryFormatter format = new BinaryFormatter(); FileStream fs = File.Open(Application.persistentDataPath + savefile, FileMode.Open); TrickSave save = (TrickSave)format.Deserialize(fs); tricks = save.tricks; nextTrickToUnlockIndex = save.nextTrickToUnlockIndex; fs.Close(); Debug.Log("Tricks loaded"); return(true); } return(false); }