UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IConsoleVariable Class Referenceabstract

#include <IConsoleManager.h>

+ Inheritance diagram for IConsoleVariable:

Classes

struct  FResolvedContext
 
struct  FSetContext
 

Public Member Functions

virtual FResolvedContext ResolveContext (const FSetContext &Context)=0
 
virtual void Set (const TCHAR *InValue, const FResolvedContext &Context)=0
 
virtual void Unset (EConsoleVariableFlags SetBy, FName Tag=NAME_None)=0
 
virtual bool GetBool () const =0
 
virtual int32 GetInt () const =0
 
virtual float GetFloat () const =0
 
virtual FString GetString () const =0
 
void GetValue (int32 &OutIntValue) const
 
void GetValue (bool &OutBoolValue) const
 
void GetValue (float &OutFloatValue) const
 
void GetValue (FString &OutStringValue) const
 
virtual void SetOnChangedCallback (const FConsoleVariableDelegate &Callback)=0
 
virtual FConsoleVariableMulticastDelegateOnChangedDelegate ()=0
 
virtual IConsoleVariableGetDefaultValueVariable ()
 
virtual FString GetDefaultValue ()=0
 
virtual void LogHistory (FOutputDevice &Ar)=0
 
virtual SIZE_T GetHistorySize ()=0
 
void Set (const TCHAR *InValue, const FSetContext &Context)
 
void Set (bool InValue, const FSetContext &Context)
 
void Set (int32 InValue, const FSetContext &Context)
 
void Set (float InValue, const FSetContext &Context)
 
template<typename T >
void Set (T Value, EConsoleVariableFlags Flags=ECVF_SetByCode, FName Tag=NAME_None)
 
template<typename T >
void SetWithCurrentPriority (T Value, FName Tag=NAME_None, EConsoleVariableFlags MaxPriority=ECVF_SetByConsole, EConsoleVariableFlags MinPriority=SETBY_ERROR)
 
template<typename T >
void ReplaceCurrentPriorityAndTag (T InValue, EConsoleVariableFlags MaxPriority=ECVF_SetByConsole, EConsoleVariableFlags MinPriority=SETBY_ERROR)
 
- Public Member Functions inherited from IConsoleObject
 IConsoleObject ()
 
virtual ~IConsoleObject ()
 
virtual const TCHARGetHelp () const =0
 
virtual void SetHelp (const TCHAR *Value)=0
 
virtual EConsoleVariableFlags GetFlags () const =0
 
virtual void SetFlags (const EConsoleVariableFlags Value)=0
 
virtual FText GetDetailedHelp () const
 
void ClearFlags (const EConsoleVariableFlags Value)
 
bool TestFlags (const EConsoleVariableFlags Value) const
 
bool IsEnabled () const
 
virtual IConsoleObjectGetParentObject () const
 
virtual class IConsoleVariableAsVariable ()
 
virtual bool IsVariableBool () const
 
virtual bool IsVariableInt () const
 
virtual bool IsVariableFloat () const
 
virtual bool IsVariableString () const
 
virtual class TConsoleVariableData< bool > * AsVariableBool ()
 
virtual class TConsoleVariableData< int32 > * AsVariableInt ()
 
virtual class TConsoleVariableData< float > * AsVariableFloat ()
 
virtual class TConsoleVariableData< FString > * AsVariableString ()
 
virtual struct IConsoleCommandAsCommand ()
 
virtual bool IsShadowObject () const
 
virtual IConsoleObjectGetShadowedObject () const
 
virtual bool IsDeprecated () const
 

Detailed Description

Interface for console variables

Member Function Documentation

◆ GetBool()

virtual bool IConsoleVariable::GetBool ( ) const
pure virtual

◆ GetDefaultValue()

virtual FString IConsoleVariable::GetDefaultValue ( )
pure virtual

◆ GetDefaultValueVariable()

virtual IConsoleVariable * IConsoleVariable::GetDefaultValueVariable ( )
inlinevirtual

Get the saved off default value, in a cvar variable, if one was created

◆ GetFloat()

virtual float IConsoleVariable::GetFloat ( ) const
pure virtual

◆ GetHistorySize()

virtual SIZE_T IConsoleVariable::GetHistorySize ( )
pure virtual

◆ GetInt()

virtual int32 IConsoleVariable::GetInt ( ) const
pure virtual

Get the internal value as int (should not be used on strings).

Returns
value is not rounded (simple cast)

Implemented in FConsoleVariableStringRef, FConsoleVariableNameRef, FConsoleVariableBitRef, FConsoleVariable< T >, FConsoleVariableRef< T >, FRangedConsoleVariable< T >, and FConsoleVariableShadow.

◆ GetString()

virtual FString IConsoleVariable::GetString ( ) const
pure virtual

◆ GetValue() [1/4]

void IConsoleVariable::GetValue ( bool OutBoolValue) const
inline

◆ GetValue() [2/4]

void IConsoleVariable::GetValue ( float OutFloatValue) const
inline

◆ GetValue() [3/4]

void IConsoleVariable::GetValue ( FString &  OutStringValue) const
inline

◆ GetValue() [4/4]

void IConsoleVariable::GetValue ( int32 OutIntValue) const
inline

Generic versions for templated code

◆ LogHistory()

◆ OnChangedDelegate()

virtual FConsoleVariableMulticastDelegate & IConsoleVariable::OnChangedDelegate ( )
pure virtual

◆ ReplaceCurrentPriorityAndTag()

template<typename T >
void IConsoleVariable::ReplaceCurrentPriorityAndTag ( InValue,
EConsoleVariableFlags  MaxPriority = ECVF_SetByConsole,
EConsoleVariableFlags  MinPriority = SETBY_ERROR 
)
inline

◆ ResolveContext()

◆ Set() [1/6]

void IConsoleVariable::Set ( bool  InValue,
const FSetContext Context 
)
inline

Set the internal value from the specified bool.

◆ Set() [2/6]

virtual void IConsoleVariable::Set ( const TCHAR InValue,
const FResolvedContext Context 
)
pure virtual

Set the internal value from the specified string.

Parameters
InValueInternal Value to Set
ContextThe ResolvedContext of the FSetContext

Implemented in FConsoleVariableBitRef, FConsoleVariable< T >, FConsoleVariable< T >, FConsoleVariableRef< T >, FConsoleVariableStringRef, FConsoleVariableNameRef, and FConsoleVariableShadow.

◆ Set() [3/6]

void IConsoleVariable::Set ( const TCHAR InValue,
const FSetContext Context 
)
inline

Set the internal value from the SetContext.

◆ Set() [4/6]

void IConsoleVariable::Set ( float  InValue,
const FSetContext Context 
)
inline

Set the internal value from the specified float.

◆ Set() [5/6]

void IConsoleVariable::Set ( int32  InValue,
const FSetContext Context 
)
inline

Set the internal value from the specified int.

◆ Set() [6/6]

template<typename T >
void IConsoleVariable::Set ( Value,
EConsoleVariableFlags  Flags = ECVF_SetByCode,
FName  Tag = NAME_None 
)
inline

◆ SetOnChangedCallback()

virtual void IConsoleVariable::SetOnChangedCallback ( const FConsoleVariableDelegate Callback)
pure virtual

Allows to specify a callback function that is called when the console variable value changes. Is even called if the value is the same as the value before. Will always be on the game thread. This can be dangerous (instead try to use RegisterConsoleVariableSink())

  • Setting other console variables in the delegate can cause infinite loops
  • Setting many console variables could result in wasteful cycles (e.g. if multiple console variables require to reattach all objects it would happen for each one)
  • The call can be at any time during initialization. As this cannot be specified during constructions you are not called on creation. We also don't call for the SetOnChangedCallback() call as this is up to the caller.

Implemented in FConsoleVariableBase, and FConsoleVariableShadow.

◆ SetWithCurrentPriority()

template<typename T >
void IConsoleVariable::SetWithCurrentPriority ( Value,
FName  Tag = NAME_None,
EConsoleVariableFlags  MaxPriority = ECVF_SetByConsole,
EConsoleVariableFlags  MinPriority = SETBY_ERROR 
)
inline

◆ Unset()

virtual void IConsoleVariable::Unset ( EConsoleVariableFlags  SetBy,
FName  Tag = NAME_None 
)
pure virtual

Unsets the value at a certain SetBy priority (this is only useful when UE_ALLOW_CVAR_HISTORY is set). The value of the CVar will be recalculated based on remaining History levels

Parameters
SetByanything in ECVF_LastSetMask e.g. ECVF_SetByScalability
Tagtag used to remove a setting from an ARRAY type SetBy

Implemented in FConsoleVariableExtendedData< T >, FConsoleVariableExtendedData< FString >, FConsoleVariableExtendedData< int >, and FConsoleVariableShadow.


The documentation for this class was generated from the following file: