public void SaveData() { YarnVisitedSave save = new YarnVisitedSave(); save.visitedNodes = _visitedNodes; BinaryFormatter format = new BinaryFormatter(); FileStream fs = File.Create(Application.persistentDataPath + savefile); //Debug.Log(Application.persistentDataPath + savefile); format.Serialize(fs, save); fs.Close(); Debug.Log("Yarn Visited Saved"); }
public bool LoadSaveData() { if (File.Exists(Application.persistentDataPath + savefile)) { BinaryFormatter format = new BinaryFormatter(); FileStream fs = File.Open(Application.persistentDataPath + savefile, FileMode.Open); YarnVisitedSave save = (YarnVisitedSave)format.Deserialize(fs); fs.Close(); _visitedNodes = save.visitedNodes; Debug.Log("Yarn Vars loaded"); return(true); } return(false); }