UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FScopedTestEnvironment Struct Reference

#include <AutomationCommon.h>

Public Member Functions

ENGINE_API ~FScopedTestEnvironment ()
 
ENGINE_API void SetConsoleVariableValue (const FString &ConsoleVariableName, const FString &Value)
 
ENGINE_API bool TryGetConsoleVariableValue (const FString &ConsoleVariableName, FString *OutValue)
 
ENGINE_API void Restore ()
 

Static Public Member Functions

static ENGINE_API TSharedPtr< FScopedTestEnvironmentGet ()
 

Detailed Description

Utility for setting and management of temporary CVars Will handle restoring the Console Variables (CVars) back to the original state on destruction.

Constructor & Destructor Documentation

◆ ~FScopedTestEnvironment()

FScopedTestEnvironment::~FScopedTestEnvironment ( )

Restores all set Console Variables back to the original value

Member Function Documentation

◆ Get()

TSharedPtr< FScopedTestEnvironment > FScopedTestEnvironment::Get ( )
static

Returns a shared pointer to current instance of the scoped test environment. Will create an instance if current instance is invalid.

Returns
the shared pointer to the instance

◆ Restore()

void FScopedTestEnvironment::Restore ( )

Restores all set Console Variables back to the original value

◆ SetConsoleVariableValue()

void FScopedTestEnvironment::SetConsoleVariableValue ( const FString &  ConsoleVariableName,
const FString &  Value 
)

Sets a Console Variable to the specified value. Will keep a reference to the original value regardless of how many times the value has been set.

Parameters
VariableNameName of the Console Variable to set
ValueValue to be applied

◆ TryGetConsoleVariableValue()

bool FScopedTestEnvironment::TryGetConsoleVariableValue ( const FString &  ConsoleVariableName,
FString *  OutValue 
)

Gets the current overridden value for the specified Console Variable

Parameters
VariableNameName of the Console Variable to fetch the current value from
OutValueCurrent value of the Console Variable if it was overridden.
Returns
true if the Console Variable was overridden.

The documentation for this struct was generated from the following files: