Enforcing Rules

June 14, 2024

·

Prefixed

Prefixed provides several methods for enforcing rules that generally fall into two categories: manual and automatic. These strategies can be used in parallel. This article discusses those methods in detail.

Manual enforcement

You can manually enforce rules for all assets in a project or for a subset of assets. The process is the same in both cases:

  1. Select assets.
  2. Run the linter.
  3. Review issues.
  4. Fix issues.

Start by opening the Content Browser in the Unreal Engine Editor and navigate to the directory that contains assets that you want to lint. Select one or more folders or one or more assets and then right-click on the selection to open the context menu. Select Run Linter.

If there are no issues, you will see a notification that this is the case. If there are issues, an Issues dialog will appear. This dialog identifies assets that violate the project naming convention, describes the changes that would fix the issues, and provides controls to modify the output. Select Apply to apply the changes or Cancel to exit the dialog without making any changes.

Automatic enforcement

Automatic enforcement follows essentially the same process as manual enforcement but allows you to automate one or more of the steps in that process. Automatic enforcement starts with asset monitoring. When Monitor Asset Changes is enabled in the Project Settings, the plugin will watch for asset creation and asset renames and flag any assets that fall out of compliance.

This is especially useful for Marketplace content. With asset monitoring, you can add a content pack to a project and get notified immediately if any assets in the pack need to be renamed.

When there are one or more issues, a notification will appear with an option to run the linter on the flagged assets. If you select Run Linter, the Issues dialog will appear, and you can review and fix issues as described above. The notification will disappear on its own when all issues are resolved (including when you fix those issues by hand).

You can take this a step further by enabling automatic linting. When Lint Automatically is enabled and issues are detected, the plugin will instead indicate that a fix is pending. After a brief period (during which you can cancel the fix), the plugin will apply the fix on its own without further user input. Among other uses, this allows you to avoid writing boilerplate prefixes and suffixes when creating new assets, as the plugin will insert them for you.



© 2021 Mustafa Moiz.