How do I use Dynamic Debugging?

// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

using System.Collections.Generic;

public class MyProjectEditorTarget : TargetRules

{

public MyProjectEditorTarget(TargetInfo Target) : base(Target)

{

Type = TargetType.Editor;

DefaultBuildSettings = BuildSettingsVersion.V5;

IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_6;

ExtraModuleNames.Add(“MyProject”);

//bOverrideBuildEnvironment \= true;



BuildEnvironment \= TargetBuildEnvironment.Unique;

WindowsPlatform.bDynamicDebugging = true;

}

}

Use Visual studio 2022 17.14.7

To use Dynamic Debugging, your MSVC version needs to be 14.44. Then, add the necessary settings by modifying the BuildConfiguration.xml file located in Engine\Saved\UnrealBuildTool.

<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration"> <WindowsPlatform> <bDynamicDebugging>true</bDynamicDebugging> </WindowsPlatform> </Configuration>

This will allow it to work properly. However, this approach enables Dynamic Debugging for both the engine and the project. I don’t know how to exclude it on a per-module basis.

For example, the current Live Coding does not support Dynamic Debugging, but I haven’t found a way to disable it.

If what you need is to enable it specifically for the project, you can try setting it in the Target.cs file, I’m not sure if it works.

`public class XxxxEditorTarget : TargetRules
{
public XxxxEditorTarget( TargetInfo Target) : base(Target)
{

WindowsPlatform.bDynamicDebugging = true;

WindowsPlatform.CompilerVersion = “Latest”;

bOverrideBuildEnvironment = true;
}
}`

Currently, we enable Dynamic Debugging support for the engine using the XML file mentioned above. Once it’s enabled for the engine, the project gets enabled automatically as well.

After enabling Dynamic Debugging using BuildConfiguration.xml, I tried setting WindowsPlatform.bDynamicDebugging = false; in the project’s Target.cs to test whether it could be disabled for a specific module. However, it didn’t work.this setting caused the entire engine to be recompiled.

This is not what we want to see. We only hope that some modules can disable Dynamic Debugging—for example, Live Coding, which is not supported.

I hope someone from the official team can provide clarification.

Hello!

All the methods that were shared should activate Dynamic Debugging is using the proper version of Visual Studio. I recommend using a Unique build environment instead of bOverrideBuildEnvironment. Overriding the editor Editor\Engine environment will result in recompiling most modules when compiling other projects (Game\Sample\UE5) than the Project that sets the override.

I logged a feature request so that Dynamic Debug can be set at the module level but I can’t make any promise as this point.

An alternative to Dynamic Debugging is to use the UE_DISABLE_OPTIMIZATION and UE_ENABLE_OPTIMIZATION macros to control the optimizer at the function\method level in specific cpp files. This allows to target specific parts of the code instead of the whole program.

Regards,

Martin

I hope that support for setting Dynamic Debugging at the module level will be available soon, or is there any way to enable Live Coding to support Dynamic Debugging?

1 Like