Sets the value to bool value.
Gets the default bool value from the CVar.
Gets the default float value from the CVar.
Gets the default int64 value from the CVar.
Gets the default String value from the CVar.
The variable description. Used to describe what the variable is used for to the user.
Sets the value to float value.
Sets the value to int64 value.
The variable name. Used to locate it within a configuration file or to be set by the user.
Sets the value to String value.
A CVar is a special type of global variable that can have it's value changed during runtime or due to some specific configuration files loaded by the framework during startup.
To declare a CVar in C++ code, you can do the following:
Please note that the CVar is a global static variable.
The first parameter is the variable name. It is a unique identifier that is used to set it's value on the editor UI, a configuration file or during runtime by another system.
The second parameter is the default value. This value will be used by the system if no other replacement is given by the user either via the Editor UI, a configuration file or during runtime.
The third parameter is a description string. This string is used to explain to the user what the variable is, what it purpose is and what are the valid values that it can be set to.
A fourth and optional parameter is a number of flags. These flags can be used to customize the variable behaviour. For example, a variable can be made read-only by setting
The CVar system supports the following data types:
float,bool,int64orString. A number of operators and implicit conversion that make possible to use the stored value similarly to any other regular object. For example, to use a the CVar as boolean value, you can do the following:The CVar system will automatically and implicitly convert any value set to it to a boolean value it will be evaluated on the if expression. For example, this variable could be set to true by setting it as: -
trueas a boolean; -1as an integer;The same implicit conversion mechanism is available for all supported data types.
Each CVar is automatically registered with the global CVarManager during construction and automatically unregistered on destruction. Registering and unregistering is thread-safe, meaning that dynamically loaded libraries can register new CVars as static global variables.