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++ / Code Organization

C++ Code Organization

Base rules for all code organization:

File Organization

Header File Organization

Source File Organization

Source files follow this structure:

  1. Includes
    1. associated header file
    2. other headers sorted alphabetically
  2. Type declarations (limited as described in Header File Organization)
  3. External variable/member definitions
  4. Function definitions in the same order as the declarations in the header file

Class Member Organization

Use the following sorting of members:

  1. Access Level
    • Sort declarations by access level: public, protected, private
    • One big continuous block per access specifier
    • Prefer private over protected and protected over public
    • Expanding access later on is a lot easier than restricting access
  2. Member Type
    • Constructors
    • Static member functions providing access to the class itself
    • Nested types
    • Member Fields
      • uproperties
      • non-uproperties
    • Member Functions
      • All overrides grouped by parent type like this:
          // - ParentTypeName
          virtual void SomeFunction() override;
          virtual void SomeOtherFunction() override;
          // --
        
      • Group function overloads together
      • Group by domain

Namespaces

Utility Functions