public static void CreateSampleSettingsFile() { XmlDocument sampleFile = new XmlDocument(); sampleFile.InnerXml = settings; sampleFile.Save(UpliftSettings.GetDefaultLocation()); }
protected void OnGUI() { #if UNITY_5_1_OR_NEWER titleContent.text = "Edit settings"; #endif scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); string settingsLocation = UpliftSettings.GetDefaultLocation(); FileSystemUtil.EnsureParentExists(settingsLocation); if (!File.Exists(settingsLocation)) { EditorGUILayout.HelpBox("It seems that you do not have a settings.xml file under HOME/.uplift.", MessageType.Warning); if (GUILayout.Button("Create a sample settings file")) { SampleFile.CreateSampleSettingsFile(); } } else { if (settingsText == null) { settingsText = System.IO.File.ReadAllText(settingsLocation); } settingsText = EditorGUILayout.TextArea(settingsText); if (GUILayout.Button("Save settings file")) { XmlDocument doc = new XmlDocument(); doc.InnerXml = settingsText; doc.Save(settingsLocation); Repaint(); } } EditorGUILayout.EndScrollView(); }