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