Compiling Game Projects

Choose your OS:

Unreal Engine 4 (UE4) uses a custom building method via the UnrealBuildTool which handles all the complex aspects of compiling the project and linking it with the engine. This process occurs transparently allowing you to simply build the project through the standard Visual Studio build workflow.

UnrealBuildTool uses the .Build.cs and .Target.cs files to build the game project. These are automatically generated when a project is created using a C++ template, or when the C++ Class Wizard is used to add code to a project created from a Blueprints Only template.

Build Configuration

UE4 and the UnrealBuildTool use different build configurations to determine how the engine is compiled. Which configuration you use will be determined by the purposes of the build you want to create.

Each build configuration contains two keywords. The first of these indicates the state of the engine and your game project. For instance, if you compile using a Debug configuration, you'll be able to debug your game's code. The second keyword indicates the target you're building for. For example, if you'd like to open a project in Unreal, you'd need to build with the Editor target keyword.

Build Configuration - State

Description

Debug

This configuration contains symbols for debugging. This configuration builds both engine and game code in debug configuration. If you compile your project using the Debug configuration and want to open the project with the Unreal Editor, you must use the "-debug" flag in order to see your code changes reflected in your project.

DebugGame

This configuration builds the engine as optimized, but leaves the game code debuggable. This configuration is ideal for debugging only game modules.

Development

This configuration is equivalent to Release. Unreal Editor uses the Development configuration by default. Compiling your project using the Development configuration enables you to see code changes made to your project reflected in the editor.

Shipping

This is the configuration for optimal performance and shipping your game. This configuration strips out console commands, stats, and profiling tools.

Test

This configuration is the Shipping configuration, but with some console commands, stats, and profiling tools enabled.

Build Configuration - Target

Description

[empty]

This configuration builds a stand-alone executable version of your project, but requires cooked content specific to the platform. Please refer to our Packaging Projects Reference page to learn more about cooked content.

Editor

To be able to open a project in Unreal Editor and see all code changes reflected, the project must be built in an Editor configuration.

Client

If you're working on a multiplayer project using UE4 networking features, this target designates the specified project as being a Client in UE4's client-server model for multiplayer games. If there is a <Game>Client.Target.cs file, the Client build configurations will be valid.

Server

If you're working on a multiplayer project using UE4 networking features, this target designates the specified project as being a Server in UE4's client-server model for multiplayer games. If there is a <Game>Server.Target.cs file, the Server build configurations will be valid.

Building with Visual Studio

Setting the Build Configuration

The build configuration can be set in the Visual Studio toolbar.

Project - Configuration Menu

Project - Configuration Menu

Setting the Solution Platform

The solution platform can be set in the Visual Studio toolbar.

UE4 currently supports the following platforms:

  • Windows 32-bit

  • Windows 64-bit

When working with Unreal Engine 4, you will typically use the Win64 platform. This is the only one included by default when generating project files; the Automatic Project File Generation page has instructions for generating project files for additional platforms.

Building the Project

Please make sure you are running Visual Studio 2015 or higher for Windows Desktop installed before proceeding. If you are using Mac, make sure to have Xcode 8 or higher installed.

  1. Set the Solution Configuration to the configuration you want to build. In this example, it is set to Development Editor. Refer to the Build Configuration section for descriptions of each available configuration.

    rocket_config_development_menu.png

  2. Right-click your game project and choose Rebuild to recompile.

    rebuild_project_outside.png

You can now run the engine with your compiled project.

When running the engine, it is important to use the Unreal Engine executable that matches the build configuration you rebuilt your project in. For example, if you compiled your project in the DebugGame Uncooked build configuration, you would run the UE4-Win64-DebugGame.exe executable with your game information as an argument. More information on the binary naming convention can be found on the Building Unreal Engine page.

When running Unreal, it is important to add the -game flag if you rebuilt your project in any Uncooked configuration, and the -debug flag if you rebuilt your project in any Debug configuration.

Visual Studio Known Issues

Issue

Solution

"Project is out of date" message always appears

Visual Studio thinks the project is out of date when it really is up to date. You can safely suppress this message by checking the Do not show this dialog again box and pressing No.

No Debugging Information window appears when using the Debug configuration

The reason for this is that the UE4editor.exe was compiled using the Development configuration. Your game project will still be debuggable when compiled using the Debug configuration despite this warning. You can safely suppress this message by checking the Do not show this dialog again box and pressing Yes.

Building with Xcode

When building in Xcode, you are only compiling the game project, not the Editor.

To compile the project:

The Unreal Engine Xcode project is configured to build Debug configuration when you use Xcode's Product > Build option and Development configuration when you use Product > Build For > Profiling. You can edit this behavior by editing the target schemes.

You can now run the engine with your compiled project.

When running the binary Editor, it is important to add the -game flag if you rebuilt your project in any Uncooked configuration, and the -debug flag if you rebuilt your project in any Debug configuration.

Xcode Known Issues

Issue

Solution

Xcode does not stop at breakpoints

Xcode's LLDB debugger needs to be configured to correctly handle breakpoints in Unreal Engine projects. You need to create (or edit, if you already have it) a .lldbinit file in your home folder and add the following line to it:

settings set target.inline-breakpoint-strategy always