// ReSharper disable once InconsistentNaming void OnGUI() { if (_optionNames == null) { _optionNames = Enum.GetNames(typeof(Options)); } _fileName = EditorGUILayout.TextField("Target file", _fileName).Trim(); if (string.IsNullOrEmpty(_fileName)) { _fileName = DefaultFileName; } _nsName = EditorGUILayout.TextField("Namespace", _nsName).Trim(); if (string.IsNullOrEmpty(_nsName)) { _nsName = DefaultNamespace; } _options = (Options)EditorGUILayout.MaskField("Options", (int)_options, _optionNames); if (GUILayout.Button("Reset settings")) { ProjectPrefs.DeleteKey(TargetFileKey); ProjectPrefs.DeleteKey(NamespaceKey); ProjectPrefs.DeleteKey(OptionsKey); OnEnable(); Repaint(); } if (GUILayout.Button("Save settings & generate")) { ProjectPrefs.SetString(TargetFileKey, _fileName); ProjectPrefs.SetString(NamespaceKey, _nsName); ProjectPrefs.SetInt(OptionsKey, (int)_options); var res = Generate(_fileName, _nsName, _options); EditorUtility.DisplayDialog(titleContent.text, res ?? "Success", "Close"); } }