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++ / Documentation

C++ Documentation Conventions

These conventions focus mostly on source code comments as 90% of your code’s documentation will be written in this format.

For API documentation it should also be totally sufficient. Even if you need some external copy of your API documentation, e.g. because you’re writing a publicly available plugin, your primary source for this external copy should stem from your source code (e.g. generated via Doxygen), so they don’t easily get out of sync.

In addition to this you should have a separate archive for additional documents and diagrams that supplement the source code based docs.

General Commenting Rules

Comment Style

API Documentation

Comments that describe API should follow the following style

Headings

Subsections, headings, etc. can use blocks of // single line comments like this:

Inline comments

Comments that are placed inline in function definitions and source files should usually use blocks of // single line comments:

void FFoo::Bar()
{
    // Number of shares must always be 42 because...
    const int32 NumSharesToBuy = 42;
}

Reflection Metadata

The UE4 reflection system allows to add metadata to uproperties and ufunctions. Most of the metadata is optional to use on a per-case basis, but we reccommend to always add the following data: