Prefixed: Modify Naming Rules

While the Unrealistic Style Guide will cover the naming of most standard Engine assets, it does not handle project- or plugin-specific assets. Fortunately, Prefixed allows you to easily define your own asset naming rules or tweak pre-existing rules to fit your needs.

Sample rule set

Elements of a Rule

You can define as many or as few rules as you would like in .prefix files, which should use JSON format. There are two required elements (and some optional elements) for each rule:

  1. Class - The asset class this rule will apply to
  2. Prefix - The prefix to use for this rule

Class

The class is the type of asset that we want to define a rule for. For C++ classes, use the core class name without any modifiers. For example:

  • UStaticMesh -> StaticMesh
  • APlayerController -> PlayerController

For Blueprint classes, just use the full class name as it appears in Editor.

Prefix

The prefix is usually a short combination of letters that hints at the type of asset it represents. For example:

  • StaticMesh -> SM_
  • PlayerController -> PC_

Prefixed does not prevent you from defining rules with conflicting or overlapping prefixes. It is up to you to make sure that each asset type has a unique prefix.

Suffix (Optional)

The suffix is optional. It should not be used as a substitute for a unique asset type prefix. Instead, it should be used to clarify sub-types of an asset type. For example, all Textures should have the same prefix (e.g. T_), but depending on the type of texture it is (diffuse, alpha, metallic, etc.) it should have an appropriate suffix (e.g. _D, _A, _M, etc.).

Example: Character

Below is what the rule would look like if you wanted subclasses of Character to have the prefix CH_.

{
  "class": "Character",
  "prefix": "CH_"
}

Overriding Rules

Keep in mind that newer rules will override older rules. This means that even if you have Engine-wide rule that Character's should have a CH_ prefix, you can override that in a project rule file that sets the prefix to CHAR_.

Hot Reloading

You do not need to restart the Editor every time you add, delete, or modify a naming rule. Prefixed detects these changes and prompts you to reload the rule set.

The rule hot reload prompt

Click the option to Update Rule Set to bring the Editor rule set up to date.


Copyright 2020 Mowgl33.