public static void SaveColumnRotate(ColumnRotate rotate) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + columnRotatePath; FileStream stream = new FileStream(path, FileMode.Create); ColumnRotateData data = new ColumnRotateData(rotate); formatter.Serialize(stream, data); stream.Close(); }
public static ColumnRotateData LoadColumnRotate() { string path = Application.persistentDataPath + columnRotatePath; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); ColumnRotateData data = formatter.Deserialize(stream) as ColumnRotateData; stream.Close(); return(data); } else { Debug.Log("File is not found. Path: " + path); return(null); } }