private void SynchRecordToJsonFile() { this.InitDirectories(); var mazeProgressSave = new MazeProgressSave(this.mazeProgressModel.currentProgress); string json = JsonUtility.ToJson( mazeProgressSave, true ); Debug.Log("SynchRecordsToJsonFile filepath: " + this.GetSavePath()); Debug.Log("SynchRecordsToJsonFile json: " + json); File.WriteAllText(this.GetSavePath(), json, Encoding.UTF8); }
private void LoadRecord() { string savePath = GetSavePath(); if (File.Exists(savePath)) { string json = File.ReadAllText(savePath); Debug.Log("Loaded json: " + json); MazeProgressSave mazeProgressSave = JsonUtility.FromJson <MazeProgressSave>(json); this.mazeProgressModel = new MazeProgressModel(mazeProgressSave.currentProgress); Debug.Log("maze progress save current progress: " + this.mazeProgressModel.currentProgress.ToString()); } }