Coding conventions for Unreal Engine 4 for C++, Blueprint and Python

Project Setup
Assets
Blueprint
C++
Python

View the Project on GitHub JonasReich/OpenUnrealConventions

Home / C++ / Formatting

C++ Code Formatting

Braces

Never omit braces with two exceptions:

// early return:
if (condition)
    return;

// early continue:
if (condition)
    continue;

Line Breaks

Always place braces on new lines:

if (condition)
{
    statements;
}
else
{
    statements;
}

If you’re using multiple inheritance, you should place all super classes after the first one one a new line:

class UFooBarComponent : public UActorComponent,
    public IFooInterface,
    public IBarInterface
{
    // ...
};

Break very long lines (more than 100-200 characters) wherever it makes sense. Indent the following lines of the same statement.

One of the most common cases for are log lines:

UE_CLOG(bShouldLogError, LogFooCategory, Error, TEXT("An error occured while reading the coding conventions! (Source Actor: %s) "
    "This can happen if you are reading too fast (current reading speed: %f)"),
    *SourceActor->GetName(), SourceActor->ReadingSpeed);

Indentation

Spaces within Statements

Switch Statements

Empty lines