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]
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 https://docs.unrealengine.com/en-US/Programming/BuildTools/UnrealBuildTool/IWYU/index.html. (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.
1>[Upgrade]
If you want to just suppress this message without upgrading your project, you need 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: https://github.com/gportelli/FixupUE4Includes.
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.
#!/usr/bin/python
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.
Resources
Fixup includes script: https://github.com/gportelli/FixupUE4Includes
Thanks for sharing, this tool is the bomb!
Thanks for this script! Saved me a lot of work.
Just a quick heads up, Content Only Plugins with no Source/ directory will throw an error and end the script
Thanks, just fixed it
Thanks man for the blog, helped me a lot!
Grazie Mille Giuseppe per la condivisione davvero una mano santa!
Many Thanks for sharing!!! Help me a lot too!