//------------------------------------------------------------------------- public EditorConfig() { // Load or Gen EditorUserSettings.json { if (!Directory.Exists(EditorContext.Instance.PathSettingsUser)) { Directory.CreateDirectory(EditorContext.Instance.PathSettingsUser); } string full_filename = Path.Combine(EditorContext.Instance.PathSettingsUser, EditorStringDef.FileEditorUserSettings); if (File.Exists(full_filename)) { using (StreamReader sr = File.OpenText(full_filename)) { string s = sr.ReadToEnd(); CfgUserSettings = UnityEngine.JsonUtility.FromJson <EditorCfgUserSettings>(s); } } if (CfgUserSettings == null) { CfgUserSettings = new EditorCfgUserSettings() { ForceUseDirResourcesLaunch = true, ForceUseDirDataOss = true }; using (StreamWriter sw = File.CreateText(full_filename)) { string s = UnityEngine.JsonUtility.ToJson(CfgUserSettings); sw.Write(s); } } } // Load EditorSettings.json { string full_filename = Path.Combine(EditorContext.Instance.PathSettings, EditorStringDef.FileEditorProjectSettings); using (StreamReader sr = File.OpenText(full_filename)) { string s = sr.ReadToEnd(); CfgProjectSettings = UnityEngine.JsonUtility.FromJson <EditorCfgProjectSettings>(s); } } }
//------------------------------------------------------------------------- public EditorConfig() { // Load or Gen EditorUserSettings.json { string full_filename = Path.Combine(EditorContext.Instance.PathSettingsUser, EditorStringDef.FileEditorUserSettings); if (!File.Exists(full_filename)) { CfgUserSettings = new EditorCfgUserSettings() { UseTmpDirRes = false }; using (StreamWriter sw = File.CreateText(full_filename)) { string s = Newtonsoft.Json.JsonConvert.SerializeObject(CfgUserSettings); sw.Write(s); } } else { using (StreamReader sr = File.OpenText(full_filename)) { string s = sr.ReadToEnd(); CfgUserSettings = Newtonsoft.Json.JsonConvert.DeserializeObject <EditorCfgUserSettings>(s); } } } // Load { string full_filename = Path.Combine(EditorContext.Instance.PathSettings, EditorStringDef.FileEditorProjectSettings); using (StreamReader sr = File.OpenText(full_filename)) { string s = sr.ReadToEnd(); CfgProjectSettings = Newtonsoft.Json.JsonConvert.DeserializeObject <EditorCfgProjectSettings>(s); } } }