

!GetInt(), !GetFloat(), !GetString()) to determine a console variables state results in a slightly slower implementation (virtual function call, possibly cache miss, etc.).įor best performance you should use same type the variable was registered with. Int32 MyVar = CVarRefractionQuality.GetValueOnGameThread() TEXT("Defines the distortion/refraction quality, adjust for quality or performance.\n") Static TAutoConsoleVariable CVarRefractionQuality( The following example has been taken from engine code: Print the console variable help text into the console.Īll Console Variables are registered when the engine is created. The state of the variable is changed and the new state printed into the console. The current state of the variable is printed into the console. The Console Variable is identified by a unique name, and the in-game console will assist the user with auto-completion while typing into the console. The user can read and write to the state.

float, int32, FString) that has an engine-wide state. user input history).Ī Console Variable is a variable of a simple data type (e.g. The Console Manager is the central point to control all those things and more (e.g.

Because of this, you should avoid the old Exec interface. The in-game console also supports auto-completion and enumeration for Console Commands and Console Variables that have been registered with the Console Manager (console command Help or DumpConsoleVariables). A Console Variable can be used to store state information that can be viewed or changed through the console. console/log response, changing internal state, etc.). Intended console variable behavior and styleĪ Console Command is a string that is sent to the engine, often typed in by the user at the in-game console, that the engine recognizes and can react to in some way (e.g. Creating / Registering a Console Variable
