Why is UE_BUILD_DEBUG never defined?

I’m trying to make a nice little build string to easily tell builds apart. Part of that is wanting to put the type of build (Debug, Dev, Shipping etc) at the end of the build string.

The helpful defines for:

  • UE_BUILD_DEBUG
  • UE_BUILD_DEVELOPMENT
  • UE_BUILD_TEST
  • UE_BUILD_SHIPPING

However if you make a packaged debug build, you’ll get Target.Configuration in your GAME.Target.cs script set to Debug while the compiler has UE_BUILD_DEVELOPMENT = 1 defined in your games c++ code (while UE_BUILD_DEBUG is 0)?

I’m not compiling the engine from source, so my hypothesis is that it’s saying the Engine was build with Development settings, so UE_BUILD_DEVELOPMENT is true for the engine. This is only a guess but it’s all I’ve got so far.

But when packaging a Debug game build, it seems really weird that UE_BUILD_DEBUG is not defined. What exactly is the difference between debug and dev builds if the #defines are identical?

Without the engine source you can’t compile the game using the standard DEBUG build configuration.

DEBUG and DEBUGGAME are not the same build configurations.
DEBUG has no optimization at all and DEBUGGAME has only turned code optimization off for the Game Modules and it has UE_BUILD_DEVELOPMENT set to 1 as you noticed.

You can use UKismetSystemLibrary::GetBuildConfiguration() to figure out if you are using DEBUG or DEBUGGAME and so on.

2 Likes

Thanks for that - good to know.

I didn’t know about that function. I ended up setting my own defines in the MyGame.Target.cs build script like so:

switch (Target.Configuration)
{
    case UnrealTargetConfiguration.Debug: ProjectDefinitions.Add("MYGAME_BUILD_DEBUG=1"); break;
   ... etc

Which then let me use them as real #defines in case anyone needs it in future. However that Kismet function would also be handy for most cases where you don’t actually want the code removed etc.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.