Navigation
API > API/Runtime > API/Runtime/Core
Console variable usage guide:
The variable should be creates early in the initialization but not before (not in global variable construction). Choose the right variable type, consider using a console command if more functionality is needed (see Exec()). Available types: bool, int, float, bool&, int&, float&, string Always provide a good help text, other should be able to understand the function of the console variable by reading this help. The help length should be limited to a reasonable width in order to work well for low res screen resolutions.
Usage in the game console:
All variables support auto completion. The single line help that can show up there is currently not connected to the help as the help text is expected to be multi line. The former Exec() system can be used to access the console variables. Use console variables only in main thread. The state of console variables is not network synchronized or serialized (load/save). The plan is to allow to set the state in external files (game/platform/engine/local). Bitmask 0x1, 0x2, 0x4, ..
| Name | EConsoleVariableFlags |
| Type | enum |
| Header File | /Engine/Source/Runtime/Core/Public/HAL/IConsoleManager.h |
| Include Path | #include "HAL/IConsoleManager.h" |
Syntax
enum EConsoleVariableFlags
{
ECVF_FlagMask = 0x0000ffff,
ECVF_Default = 0x0,
ECVF_Cheat = 0x1,
ECVF_ReadOnly = 0x4,
ECVF_Unregistered = 0x8,
ECVF_CreatedFromIni = 0x10,
ECVF_RenderThreadSafe = 0x20,
ECVF_Scalability = 0x40,
ECVF_ScalabilityGroup = 0x80,
ECVF_Preview = 0x100,
ECVF_GeneralShaderChange = 0x200,
ECVF_MobileShaderChange = 0x400,
ECVF_DesktopShaderChange = 0x800,
ECVF_ExcludeFromPreview = 0x1000,
ECVF_SaveForNextBoot = 0x2000,
ECVF_SetFlagMask = 0x00ff0000,
ECVF_Set_NoSinkCall_Unsafe = 0x00010000,
ECVF_Set_SetOnly_Unsafe = 0x00020000,
ECVF_Set_ReplaceExistingTag = 0x00040000,
ECVF_SetByMask = 0xff000000,
ECVF_SetByConstructor = 0x00000000,
ECVF_SetByScalability = 0x01000000,
ECVF_SetByGameSetting = 0x02000000,
ECVF_SetByProjectSetting = 0x03000000,
ECVF_SetBySystemSettingsIni = 0x04000000,
ECVF_SetByPluginLowPriority = 0x05000000,
ECVF_SetByDeviceProfile = 0x06000000,
ECVF_SetByPluginHighPriority = 0x07000000,
ECVF_SetByGameOverride = 0x08000000,
ECVF_SetByConsoleVariablesIni = 0x09000000,
ECVF_SetByHotfix = 0x0A000000,
ECVF_SetByPreview = 0x0B000000,
ECVF_SetByCommandline = 0x0C000000,
ECVF_SetByCode = 0x0D000000,
ECVF_SetByConsole = 0x0E000000,
}
Values
| Name | Remarks |
|---|---|
| ECVF_FlagMask | Mask for flags. Use this instead of ~ECVF_SetByMask |
| ECVF_Default | Default, no flags are set, the value is set by the constructor |
| ECVF_Cheat | Console variables marked with this flag behave differently in a final release build. |
| ECVF_ReadOnly | Console variables cannot be changed by the user (from console). |
| ECVF_Unregistered | UnregisterConsoleObject() was called on this one. |
| ECVF_CreatedFromIni | This flag is set by the ini loading code when the variable wasn't registered yet. |
| ECVF_RenderThreadSafe | Maintains another shadow copy and updates the copy with render thread commands to maintain proper ordering. |
| ECVF_Scalability | ApplyCVarSettingsGroupFromIni will complain if this wasn't set, should not be combined with ECVF_Cheat and ECVF_ExcludeFromPreview. |
| ECVF_ScalabilityGroup | Those cvars control other cvars with the flag ECVF_Scalability, names should start with "sg." |
| ECVF_Preview | CVars with this flag will be included in the device profile previews. |
| ECVF_GeneralShaderChange | Cvars with this flag will modify the Shader Keystring for All Platforms |
| ECVF_MobileShaderChange | Cvars with this flag will modify the Shader Keystring for Mobile Platforms |
| ECVF_DesktopShaderChange | Cvars with this flag will modify the Shader Keystring for Desktop Platforms |
| ECVF_ExcludeFromPreview | CVars with this flag will be excluded from the device profile previews. |
| ECVF_SaveForNextBoot | CVars with this flag will be saved into local temp file for next boot after hotfixed. |
| ECVF_SetFlagMask | Set flags |
| ECVF_Set_NoSinkCall_Unsafe | Use to set a cvar without calling all cvar sinks. Much faster, but potentially unsafe. Use only if you know the particular cvar/setting does not require a sink call. |
| ECVF_Set_SetOnly_Unsafe | Similar to ECVF_Set_NoSinkCall_Unsafe, but this will do nothing but set the cvar, and push updates to render thread, no changing flags, no sinks, etc. |
| ECVF_Set_ReplaceExistingTag | When this is set, this will stomp on existing tagged array type values in place, instead of adding to the end of the array. |
| ECVF_SetByMask | To get some history of where the last value was set by ( useful for track down why a cvar is in a specific state |
| ECVF_SetByConstructor | Lowest priority (default after console variable creation) |
| ECVF_SetByScalability | Set by scalability groups from Scalability.ini (lower priority than game settings so it's easier to override partially). THIS IS AN ARRAY TYPE. |
| ECVF_SetByGameSetting | Default priority for engine-level game user settings, platform-specific settings will override this. |
| ECVF_SetByProjectSetting | Set by project settings UI or specific sections in ini file (higher priority than game setting to allow enforcing some settings for this project) |
| ECVF_SetBySystemSettingsIni | Used by the [ConsoleVariables] section of Engine.ini as well as FSystemSettings. |
| ECVF_SetByPluginLowPriority | Dyanmically loaded/unloaded plugins, used with the History concept to restore cvars on plugin unload. THIS IS AN ARRAY TYPE meaning multiple vales with this SetBy are stored in the history. |
| ECVF_SetByDeviceProfile | Per device settings using the DeviceProfiles.ini hierarchy (e.g. specific iOS device, higher priority than per project to do device specific settings). THIS IS AN ARRAY TYPE. |
| ECVF_SetByPluginHighPriority | Dyanmically loaded/unloaded plugins, used with the History concept to restore cvars on plugin unload. THIS IS AN ARRAY TYPE meaning multiple vales with this SetBy are stored in the history. |
| ECVF_SetByGameOverride | User settable game overrides, used for GameUserSettings fields that need to override device specific settings. |
| ECVF_SetByConsoleVariablesIni | Set by local consolevariables.ini, mostly used for testing multiple projects. |
| ECVF_SetByHotfix | Set by hotfix. THIS IS AN ARRAY TYPE meaning multiple vales with this SetBy are stored in the history. |
| ECVF_SetByPreview | Set for previewing in editor. THIS IS AN ARRAY TYPE meaning multiple vales with this SetBy are stored in the history. |
| ECVF_SetByCommandline | Used by some command line parameters, others use the Console priority instead. |
| ECVF_SetByCode | Used for high priority temporary debugging or operation modes. |
| ECVF_SetByConsole | Highest priority used via editor UI or or game/editor interactive console. |