Skip to main content
Version: 2.x

C++ console variables

C++ console variables are custom game console variables registered by your project code. Use them when your project owns the console variable in C++ or needs C++ registration behavior, validation, or change callbacks.

Auto Settings does not register C++ console variables. Project code owns registration before Auto Settings reads the variable.

Define the console variable in C++

Set the default value where the console variable is registered with Unreal's native console variable API. The C++ registration owns the initial value, help text, flags, and any native callbacks.

#include "HAL/IConsoleManager.h"

static TAutoConsoleVariable<float> CVarMasterVolume(
TEXT("game.MasterVolume"),
1.0f,
TEXT("Master volume multiplier (0.0 to 1.0)"),
ECVF_Default
);

For full registration patterns, flags, and callback options, see Unreal Engine's Console Variables C++ documentation.