public static void SaveFeelings(GameController mainGame) { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.persistentDataPath + "/feelings.sav", FileMode.Create); DiagnosisStats data = new DiagnosisStats(mainGame); bf.Serialize(stream, data); Debug.Log("Saved"); stream.Close(); }
public static List <String> LoadDiagnosisStats() { string filepath = Application.persistentDataPath + "/feelings.sav"; if (File.Exists(filepath)) { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(filepath, FileMode.Open); DiagnosisStats data = bf.Deserialize(stream) as DiagnosisStats; stream.Close(); return(data.statsList); } else { Debug.Log("No file here"); return(null); } }