public static void SetGPGSAutoEntry(bool enabled) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/gpgsautoent.data"; FileStream stream = new FileStream(path, FileMode.Create); GPGSAutoEntry data = new GPGSAutoEntry(); data.enabled = enabled; formatter.Serialize(stream, data); stream.Close(); }
public static GPGSAutoEntry GPGSAutoEntryStat() { string path = Application.persistentDataPath + "/gpgsautoent.data"; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); GPGSAutoEntry data = formatter.Deserialize(stream) as GPGSAutoEntry; stream.Close(); return(data); } else { Debug.Log("saved data not found in" + path); return(null); } }