public void Init() { bf = new BinaryFormatter(); filePath = Application.persistentDataPath + "/" + fileName; Debug.Log(filePath); if (System.IO.File.Exists(filePath)) { anchorToRecordingMap = new SerializableAnchorMap(); LoadAll(); } else { anchorToRecordingMap = new SerializableAnchorMap(); } }
public void LoadAll() { FileStream fs = File.Open(filePath, FileMode.Open); try { anchorToRecordingMap = (SerializableAnchorMap)bf.Deserialize(fs); } catch (SerializationException e) { Console.WriteLine("Failed to deserialize. Reason: " + e.Message); throw; } finally { fs.Close(); } }