public override void OnGUI(string searchContext) { _serializedObject.UpdateIfRequiredOrScript(); using (new LabeledScope(Styles.SourceGenerationLabel)) { EditorGUILayout.PropertyField(_namespaceProp, new GUIContent("Namespace")); EditorGUILayout.PropertyField(_outputPathProp, new GUIContent("Output Directory")); using (new LabeledScope(Styles.GenerateTargetsLabel)) { EditorGUILayout.PropertyField(_generateSceneProp, new GUIContent("Scene")); EditorGUILayout.PropertyField(_generateSortingLayerProp, new GUIContent("SortingLayer")); EditorGUILayout.PropertyField(_generateLayerProp, new GUIContent("Layer")); EditorGUILayout.PropertyField(_generateTagProp, new GUIContent("Tag")); } EditorGUILayout.Space(); if (GUILayout.Button("Generate", EditorStyles.miniButtonRight)) { using (AssetEditing.Scope()) { UnityConstantValuesGenerator.UpdateUnityConstants(); UnityConstantValuesGenerator.UpdateSceneValues(); } AssetDatabase.Refresh(); } } _serializedObject.ApplyModifiedProperties(); }
public override void OnGUI(string searchContext) { using (new LabeledScope(Styles.SourceGenerationLabel)) { EditorGUI.BeginChangeCheck(); _generateSetting.@namespace = EditorGUILayout.TextField(new GUIContent("Namespace"), _generateSetting.@namespace); _generateSetting.outputDir = EditorGUILayout.TextField(new GUIContent("Output Directory"), _generateSetting.outputDir); using (new LabeledScope(Styles.GenerateTargetsLabel)) { _generateSetting.generateSceneValues = EditorGUILayout.Toggle(new GUIContent("Scene"), _generateSetting.generateSceneValues); _generateSetting.generateSortingLayerValues = EditorGUILayout.Toggle(new GUIContent("SortingLayer"), _generateSetting.generateSortingLayerValues); _generateSetting.generateLayerValues = EditorGUILayout.Toggle(new GUIContent("Layer"), _generateSetting.generateLayerValues); _generateSetting.generateTagValues = EditorGUILayout.Toggle(new GUIContent("Tag"), _generateSetting.generateTagValues); } EditorGUILayout.Space(); if (EditorGUI.EndChangeCheck()) { UnityConstantsGeneratorSettings.Save(); } if (GUILayout.Button("Generate", EditorStyles.miniButtonRight)) { using (AssetEditing.Scope()) { UnityConstantValuesGenerator.UpdateUnityConstants(); UnityConstantValuesGenerator.UpdateSceneValues(); } AssetDatabase.Refresh(); } } }