public void BackupData() { Room_Editor_Wrapper wrapper = new Room_Editor_Wrapper(); wrapper.data = editorData; string contents = JsonUtility.ToJson(wrapper, true); System.IO.File.WriteAllText(backup, contents); }
public void ReadData() { try { if (System.IO.File.Exists(path)) { string contents = System.IO.File.ReadAllText(path); Room_Editor_Wrapper wrapper = JsonUtility.FromJson <Room_Editor_Wrapper>(contents); editorData = wrapper.data; } else { Debug.Log("Unable to read the save data, file does notexist"); } } catch (System.Exception ex) { Debug.Log(ex.Message); } }