public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); EditorGUILayout.LabelField(EditorConstants.PackageJsonHeader, EditorStyles.boldLabel); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.PropertyField(serializedObject.FindProperty(IdPropertyName)); EditorGUI.EndDisabledGroup(); EditorGUILayout.PropertyField(serializedObject.FindProperty(NamePropertyName)); EditorGUILayout.PropertyField(serializedObject.FindProperty(DisplayNameProperty)); EditorGUILayout.PropertyField(serializedObject.FindProperty(PackageVersionPropertyName)); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(serializedObject.FindProperty(UnityVersionPropertyName)); EditorGUILayout.EndHorizontal(); EditorGUILayout.PropertyField(serializedObject.FindProperty(DescriptionPropertyName)); EditorGUILayout.PropertyField(serializedObject.FindProperty(CategoryPropertyName)); _keywordReorderableList.DoLayoutList(); _dependenciesReorderableList.DoLayoutList(); EditorGUILayout.Space(); EditorGUILayout.LabelField(EditorConstants.PackageContentHeader, EditorStyles.boldLabel); _sourcePathsReorderableList.DoLayoutList(); _excludePathsReorderableList.DoLayoutList(); EditorGUILayout.BeginHorizontal(); var destinationPathProperty = serializedObject.FindProperty(DestinationPathPropertyName); EditorGUILayout.PropertyField( destinationPathProperty, GUILayout.Height(EditorConstants.FolderPathPickerHeight)); GUILayoutTools.DrawFolderPickerLayout( destinationPathProperty, EditorConstants.SelectPackageExportPathPickerTitle); EditorGUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } EditorGUILayout.Space(); EditorGUILayout.LabelField(EditorConstants.PackageActionsHeader, EditorStyles.boldLabel); if (GUILayout.Button(EditorConstants.UpdatePackageButtonText)) { FileTools.CreateOrUpdatePackageSource((PackageManifestConfig)target); } }
public override void OnInspectorGUI() { var config = (PackageManifestConfig)target; using (var scope = new EditorGUI.ChangeCheckScope()) { EditorGUILayout.LabelField(EditorConstants.PACKAGE_JSON_HEADER, EditorStyles.boldLabel); using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.PropertyField(serializedObject.FindProperty(ID_PROPERTY_NAME)); } EditorGUILayout.PropertyField(serializedObject.FindProperty(NAME_PROPERTY_NAME)); EditorGUILayout.PropertyField(serializedObject.FindProperty(DISPLAY_NAME_PROPERTY)); EditorGUILayout.PropertyField(serializedObject.FindProperty(PACKAGE_VERSION_PROPERTY_NAME)); EditorGUILayout.PropertyField(serializedObject.FindProperty(UNITY_VERSION_PROPERTY_NAME)); EditorGUILayout.PropertyField(serializedObject.FindProperty(DESCRIPTION_PROPERTY_NAME)); EditorGUILayout.PropertyField(serializedObject.FindProperty(CATEGORY_PROPERTY_NAME)); _keywordReorderableList.DoLayoutList(); _dependenciesReorderableList.DoLayoutList(); EditorGUILayout.Space(); EditorGUILayout.LabelField(EditorConstants.PACKAGE_CONTENT_HEADER, EditorStyles.boldLabel); _sourcePathsReorderableList.DoLayoutList(); _excludePathsReorderableList.DoLayoutList(); // Package Source Export using (new EditorGUILayout.HorizontalScope()) { var destinationPathProperty = serializedObject.FindProperty(DESTINATION_PATH_PROPERTY_NAME); EditorGUILayout.PropertyField( destinationPathProperty, GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT)); GUILayoutTools.DrawFolderPickerLayout( destinationPathProperty, EditorConstants.SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE); } // Legacy Package Export using (new EditorGUILayout.HorizontalScope()) { var legacyPackagePathProperty = serializedObject.FindProperty(LEGACY_PACKAGE_PATH_PROPERTY_NAME); EditorGUILayout.PropertyField( legacyPackagePathProperty, GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT)); GUILayoutTools.DrawFolderPickerLayout( legacyPackagePathProperty, EditorConstants.SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE); } // Version Constants Export using (new EditorGUILayout.VerticalScope(EditorConstants.GROUP_BOX)) { // Namespace var namespaceProperty = serializedObject.FindProperty(VERSION_CONSTANTS_NAMESPACE_PROPERTY_NAME); EditorGUILayout.PropertyField(namespaceProperty); if (string.IsNullOrEmpty(namespaceProperty.stringValue)) { EditorGUILayout.HelpBox(EditorConstants.GLOBAL_NAMESPACE_WARNING, MessageType.Info); } // Output folder using (new EditorGUILayout.HorizontalScope()) { var versionConstantsPathProperty = serializedObject.FindProperty(VERSION_CONSTANTS_PATH_PROPERTY_NAME); EditorGUILayout.PropertyField( versionConstantsPathProperty, GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT)); GUILayoutTools.DrawFolderPickerLayout( versionConstantsPathProperty, EditorConstants.SELECT_VERSION_CONSTANTS_PATH_PICKER_TITLE); } } if (scope.changed) { serializedObject.ApplyModifiedProperties(); } } EditorGUILayout.Space(); EditorGUILayout.LabelField(EditorConstants.PACKAGE_ACTIONS_HEADER, EditorStyles.boldLabel); if (GUILayout.Button(new GUIContent( EditorConstants.GENERATE_VERSION_CONSTANTS_BUTTON_TEXT, EditorConstants.GENERATE_VERSION_CONSTANTS_TOOLTIP))) { CodeGenTools.GenerateVersionConstants(config); } if (GUILayout.Button(EditorConstants.UPDATE_PACKAGE_BUTTON_TEXT)) { FileTools.CreateOrUpdatePackageSource(config); } if (GUILayout.Button(EditorConstants.EXPORT_LEGACY_PACKAGE_BUTTON_TEXT)) { UnityFileTools.CompileLegacyPackage(config); } }