Game Dev | Programming

A script to fixup includes for Unreal Engine 4.24

Since version 4.24, Unreal Engine has changed some values for the default build settings. If you just upgraded some project to 4.24, you’ll see this message when starting a build:

1>[Upgrade] Using backward-compatible build settings. The latest version of UE4 sets the following values by default, which may require code changes:
1>[Upgrade]     bLegacyPublicIncludePaths = false                 => Omits subfolders from public include paths to reduce compiler command line length. (Previously: true).
1>[Upgrade]     ShadowVariableWarningLevel = WarningLevel.Error   => Treats shadowed variable warnings as errors. (Previously: WarningLevel.Warning).
1>[Upgrade]     PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs   => Set in build.cs files to enables IWYU-style PCH model. See (Previously: PCHUsageMode.UseSharedPCHs).
1>[Upgrade] Suppress this message by setting 'DefaultBuildSettings = BuildSettingsVersion.V2;' in MyProjectEditor.Target.cs, and explicitly overriding settings that differ from the new defaults.

To suppress this message you have to add DefaultBuildSettings = BuildSettingsVersion.V2; to the project Target.cs files.

// MyProjectEditor.Target.cs
public class MyProjectTarget : TargetRules
    public MyProjectTarget(TargetInfo Target) : base(Target)
        DefaultBuildSettings = BuildSettingsVersion.V2;
        // ...

Now you can override settings that differ from the new defaults.

If you want to stick to the new bLegacyPublicIncludePaths = false; you have to update all the includes and fix all the paths by adding the subfolders.

I’ve come up with a Python script to update all the include paths automatically. You can find it on GitHub here:

The script runs on Python 3. Before running it, you have to set two configuration variables inside the code which define your project path and the engine installation path.


import os, sys
import re

project_path = "C:/Projects/MyAwesomeProject"
engine_path  = "C:/Program Files/Epic Games/UE_4.24/Engine"

The script will first build a database of header filenames and paths by scanning all the engine’s source header files, including files in all plugins. Then it will scan all the project source files (including plugins) and replace the include paths. It will also enforce the angular brackets include style for the engine includes and the double quotes for the project includes.


Fixup includes script:

Leave a Reply