public void SaveMissions(IOMissionModel missions) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + missionsFileName, FileMode.Open); bf.Serialize(file, missions); file.Close(); }
public IOMissionModel LoadMission() { if (File.Exists(Application.persistentDataPath + missionsFileName)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + missionsFileName, FileMode.Open); IOMissionModel score = (IOMissionModel)bf.Deserialize(file); file.Close(); return(score); } return(new IOMissionModel()); }