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:
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
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
A variant is used to identify a subset of a base. For example, skeletal mesh skins of the character Amena might be
SKM_Amena_BeachParty, etc. Generic variants should be named using two digits. For example,
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.
|Blueprint Function Library
|Blueprint Macro Library
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:
|Aim Offset 1D
|Aim Offset (2D)
|Blend Space 1D
|Blend Space (2D)
|(Skeletal) Pose Asset
|(Skeletal) Physics Asset
|Material (Post Process)
|Material Parameter Collection
|Texture (Ambient Occlusion)
|Cube Render Target
|Texture Light Profile
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.
|Niagara Effect Type
|Niagara Dynamic Input Script (General)
|Niagara Dynamic Input Script (Function)
|Niagara Dynamic Input Script (Module)
|Niagara Parameter Collection
|Niagara Parameter Collection Instance
|Physical Material Mask
|Should be named after corresponding Sound Class
|Widget Blueprint (Used In World)
|Slate Widget Style
Epic recently put out a C++ style guide. It covers most use cases and should be followed absent a compelling countervailing reason.