The Open Unreal Conventions are an open source set of coding and asset conventions for Unreal Engine 4 projects created and maintained by Jonas Reich.
These conventions should serve as a foundation for all aspects of Unreal Engine development. This means they cover not only C++ code, but also Blueprints, Python and Asset creation. Over time we might also add some conventions for complementary tools like batch scripts for building Unreal Engine games.
The coding conventions are a work-in-progress project. This list shows the current status of the sub-conventions:
You probably are not the only developer in a project. And even if you are you will most certainly come back to a piece of code, a blueprint or an asset folder that you haven’t seen in a while. It is very likely that you will forget and re-learn half of the things you worked on over the course of a project.
Creating a structure that is easily parse-able for an uninformed viewer is crucial for project maintainability. And all other rules are based on this very thought.
This should usually manifest in thinking about the big picture first and structuring your content from big to small.
There is a rule in psychology stating humans cannot easily separate and memorize groups of more than seven objects (plus minus seven). We can apply this rule to our C++ code and Blueprints saying you should introduce logical groupings once you have more than 7-10 variables, functions, etc.
Of course this all depends on the context, but it’s a good rule of thumb to recognize code, blueprints, etc that are too crowded.
For all logical programming no matter the language (Blueprints, C++, Python) you must always adhere to the following basic rules:
Always use PascalCase. This applies for assets, folder names, variable names, function names, you name it.
Never use spaces for names. This is mainly important for asset and folder names (including the folders in which you store your unreal projet), but can also be extended to variables and functions in your Blueprints.
Stick to Latin Alphanumerics and underscores. Never use special unicode characters, umlauts or any other special characters. In short, stick to this set of characters:
Keep names short and concise. Short and readable is the key here. Other devs still need to understand what you mean. Unreal enforces a 180 character path limit for all source files and assets, so keeping file and folder names short is essential. It also makes file lists, debug logs, etc easier to read. This last point also applies to function and variable names.
These coding conventions are based on a mixture of the following coding conventions:
The following sources are reccommended reading material for their respective topic:
Unreal Engine 4 Documentation - The official docs should be your first address for everything Unreal related. It used to be quite outdated with gaping holes, but since UE4.24 onwards the documentation has caught up with some of the latest developments of the Engine itself.
Still not everything is documented in here, but for everything that is, it’s usually the best introduction into each respective topic if not the most comprehensive.
Unreal Engine 4 Source Code - The engine’s source code is shipped with every UE4 installation, so whenever you want to know what’s really going on under the hood, see examples how a certain system/function should be used, etc. this is the place to look.
The source code is really well documented (at least in the important places - some plugins could improve) and will often times contain better comments + explanations besides the code itself than the online documentation.
The Open Unreal Conventions are licensed under the MIT license.
You are invited to create pull-requests to the github source for any additions or modifications you make to the guidelines.