March 22, 2020
A practical set of style conventions for assets, code, and other things in Unreal Engine 4.
In the developer universe, there is an oft-cited mantra that there is no such thing as "good" or "bad" style. Instead, it has been said:
"Arguments over style are pointless. There should be a style guide, and you should follow it."
I disagree. Having come from a legal background, I can say with certainty that there is such a thing as good and bad style, just as there is good and bad writing. Indeed, quality lawyers spend their working lives trying to become better writers (until they become judges, at which point all writing skill and common sense goes out the window).
There are sentences, words, and formats that convey meaning well, and then there are sentences, words, and formats that obfuscate, confuse, and mislead. The same can be said for software development. After all, the end user is the same in each domain: human. As humans building for other humans (including ourselves), the empathetic thing to do is to maintain good style to the extent we can.
With that said, the following style rules are designed as a lowest common denominator. Each project, like each essay or brief, will have its own unique classes and logical structure that defy one-size-fits-all classification. However, each project should strive to follow these basic guidelines. (Thanks are due to Michael Allar for creating the Gamemakin UE4 Style Guide, which served as the inspiration for this style guide.)
There is an Editor plugin available on the Marketplace that allows you to easily enforce the asset styling conventions in this guide (or to edit those conventions to fit your needs).
To discuss this style guide, add a comment to the dedicated page on Unrealistic.dev.
There are three main buckets that Unreal Engine 4 content falls into:
.uasset
extension..cpp
, .h
, or .cs
extension.This guide will approach styling using this basic structure.
An 'asset' can mean many things in many contexts. In Unreal Engine 4, and for purposes of this guide, an asset means any file that has a .uasset
extension.
This guide provides rules for many of the standard asset types. However, there is no way it can account for game- or project-specific assets (e.g. projectiles, quests, etc.). This does not mean that you should not establish rules for those assets yourself.
As new asset types get added to your project, define corresponding naming conventions for those asset types and enforce them.
The name of an asset is made up of four elements:
A prefix is typically a combination of letters that hints at the asset type. For example, SM_
is used for StaticMesh
. With the exception of Blueprint Enumerations and Structures, every prefix should include an underscore (_
). Every asset should have a prefix.
The base is the locus of the asset. For example, assets related to the character Amena would have the base Amena
(e.g. P_Amena_Explosion
, T_Amena_Eyes
, etc.).
A variant is used to identify a subset of a base. For example, skeletal mesh skins of the character Amena might be SKM_Amena_Summer
, SKM_Amena_Sand
, SKM_Amena_BeachParty
, etc. Generic variants should be named using two digits. For example, SM_Tree_01
, SM_Tree_02
, SM_Tree_03
, etc.
A suffix is used to identify a subset of an asset type. Certain assets, such as Textures, will have various sub-types (e.g. diffuse, normal, alpha) which are not reflected in the prefix and which cannot otherwise be determined without opening up the asset itself. In these limited circumstances, a suffix can help to provide further context in a consistent way. A suffix is not a substitute for a prefix. Most assets will not have a suffix.
Asset names should not have spaces. Asset names should not have underscores, except for prefixes and suffixes. Bases and variants should be in PascalCase.
Pair the base and variant of your asset with the following modifiers to calculate the final name for your asset.
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
Blueprint (Objects) | BP_ | ||
Blueprint (Components) | BPC_ | ||
Blueprint Interface | BPI_ | ||
Blueprint Function Library | BPFL_ | ||
Blueprint Macro Library | BPML_ | ||
Enumeration | E | ||
Structure | F |
Many assets come with Blueprint scripting - Objects, Actors, Widgets, etc. This has led to the unfortunate practice of using the BP_
prefix with anything that incorporates Blueprint scripting. In turn, this results in a Content directory full of BP_
prefixed assets, with no way to tell what each one is without looking at the thumbnail or opening the asset.
We can do better than that. Only apply the BP_
prefix to Object Blueprints. Do not apply the prefix to:
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
Actor | ACT_ | ||
Pawn | PWN_ | ||
Character | CH_ | ||
PlayerController | PC_ | ||
PlayerState | PS_ | ||
GameModeBase | GM_ | ||
GameStateBase | GS_ | ||
GameInstance | GI_ |
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
Animation Sequence | A_ | ||
Animation Composite | AC_ | ||
Animation Montage | AM_ | ||
Animation Blueprint | ABP_ | ||
Aim Offset 1D | AO1_ | ||
Aim Offset (2D) | AO2_ | ||
Blend Space 1D | BS1_ | ||
Blend Space (2D) | BS2_ |
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
Rig | RIG_ | ||
Skeleton | SK_ | ||
Skeletal Mesh | SKM_ | ||
(Skeletal) Pose Asset | SKP_ | ||
(Skeletal) Physics Asset | SKPH_ |
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
AI Controller | AIC_ | ||
Behavior Tree | BT_ | ||
Blackboard | BB_ | ||
Decorator | BTDecorator_ | ||
Service | BTService_ | ||
Task | BTTask_ |
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
Material | M_ | ||
Material (Decal) | M_ | _Decal | |
Material (Post Process) | M_ | _PP | |
Material (UI) | M_ | _UI | |
Material Function | MF_ | ||
Material Instance | MI_ | ||
Material Parameter Collection | MPC_ |
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
Texture | T_ | ||
Texture (Diffuse/Albedo/Base) | T_ | _D | |
Texture (Normal) | T_ | _N | |
Texture (Roughness) | T_ | _R | |
Texture (Alpha/Opacity) | T_ | _A | |
Texture (Ambient Occlusion) | T_ | _O | |
Texture (Bump) | T_ | _B | |
Texture (Emissive) | T_ | _E | |
Texture (Mask) | T_ | _M | |
Texture (Specular) | T_ | _S | |
Texture Cube | TC_ | ||
Media Texture | MT_ | ||
Render Target | RT_ | ||
Cube Render Target | CRT_ | ||
Texture Light Profile | TLP_ |
From the Gamemakin LLC style guide:
It is common practice to pack multiple layers of texture data into one texture. An example of this is packing Emissive, Roughness, Ambient Occlusion together as the Red, Green, and Blue channels of a texture respectively. To determine the suffix, simply stack the given suffix letters from above together, e.g. _ERO.
It is generally acceptable to include an Alpha/Opacity layer in your Diffuse/Albedo's alpha channel and as this is common practice, adding A to the _D suffix is optional.
Packing 4 channels of data into a texture (RGBA) is not recommended except for an Alpha/Opacity mask in the Diffuse/Albedo's alpha channel as a texture with an alpha channel incurs more overhead than one without.
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
StaticMesh | SM_ |
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
Particle System | P_ | ||
Niagara System | NFX_ | ||
Niagara Emitter | NFXE_ | ||
Niagara Effect Type | NFXET_ | ||
Niagara Dynamic Input Script (General) | NFXS_ | ||
Niagara Dynamic Input Script (Function) | NFXS_ | _FN | |
Niagara Dynamic Input Script (Module) | NFXS_ | _MOD | |
Niagara Parameter Collection | NFXP_ | ||
Niagara Parameter Collection Instance | NFXPI_ |
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
Physical Material | PHYSM_ | ||
Physical Material Mask | PHYSMM_ |
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
Sound Cue | S_ | ||
Sound Wave | SW_ | ||
Sound Attenuation | SATT_ | ||
Sound Mix | SMIX_ | ||
Sound Class | SCL_ | ||
Sound Concurrency | SCN_ | Should be named after corresponding Sound Class |
Asset Type | Prefix | Suffix | Notes |
---|---|---|---|
Widget Blueprint | W_ | ||
Widget Blueprint (Used In World) | W_ | _World | |
Font | FONT_ | ||
Slate Brush | SBR_ | ||
Slate Widget Style | SWS_ |
Epic recently put out a C++ style guide. It covers most use cases and should be followed absent a compelling countervailing reason.