Live Coding Primer

Article written by Branden T.

Live Coding is a tool that can be used within the Editor, that allows the hot-reload of C++ code for faster iteration when developing. This means that you can patch all or part of your code, while a Play-In-Editor process is still running. This document aims to provide a quick starting point, and outline some common issues experienced when using Live Coding

Note: With UE4’s Live Coding, changes to header files that result in changes to UCLASS, UINTERFACE, USTRUCT, UENUM, or UFUNCTION elements are not supported. Live Coding is intended mostly for simple and strategic changes to routines.

Using Live Coding

There are two ways to enable Live Coding:

Checking “Enable Live Coding” in the Compile Toolbar

Checking “Enable Live Coding” in the Editor Preferences

You can also access more Live Coding settings by clicking “Settings” on the toolbar menu.

Live Coding output will be to its own console. To show this console, click “Show Console” in the toolbar

After Live Coding is enabled, to hot-reload any modules that are changed, use the hotkey Ctrl + Alt + F11

Common Issues

Game or Editor Crashes After Live Editing

Changes to data structures aren’t supported and can result in corrupted data. Avoid making changes to header files unless those changes are inline function implementation changes.

Visual Studio Complains About Code Changing

Visual Studio sometimes complains about source that has been modified, and asks the user what to do with it, which can be annoying when iterating a lot with Live Coding.

To stop this complaint pop-up, disable Visual Studio’s “Edit and Continue” feature in the Options

In some instances, disabling the “Require source files to exactly match the original version” option is also required

New Engine Module “Not Enabled” for Live Coding

A module might be loaded by the editor as part of a dependency on another module. However, if that module doesn’t appear in the list of modules in the editor, then it won’t be available for live editing (or probably even hot reload). You need to edit your game’s .uproject file and add the module or plugin there for it to be considered “enabled” for Live Coding.

1 Like