fx.NiagaraMaxStatInstanceReports
fx.NiagaraMaxStatInstanceReports
#Overview
name: fx.NiagaraMaxStatInstanceReports
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The max number of different instances from which stat reports are aggregated.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of fx.NiagaraMaxStatInstanceReports is to control the maximum number of different instances from which statistical reports are aggregated in the Niagara visual effects system.
This setting variable is primarily used by the Niagara plugin, which is part of Unreal Engine’s FX (effects) system. Specifically, it’s utilized in the NiagaraCommon module, which handles common functionality for the Niagara system.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 20 but can be changed at runtime using console commands or through configuration files.
The associated variable GNiagaraMaxStatInstanceReports directly interacts with fx.NiagaraMaxStatInstanceReports. They share the same value, with GNiagaraMaxStatInstanceReports being the actual variable used in the C++ code to enforce the limit.
Developers should be aware that this variable limits the number of unique Niagara instances that contribute to statistical reports. If the number of instances exceeds this limit, older data points will be randomly removed to make room for new ones.
Best practices when using this variable include:
- Setting an appropriate value based on the scale and complexity of your Niagara effects. Too low a value might not provide enough data for accurate profiling, while too high a value could impact performance.
- Monitoring the impact of changes to this value on both the quality of statistical data and overall performance.
- Considering adjusting this value dynamically based on the current scene complexity or performance requirements.
Regarding the associated variable GNiagaraMaxStatInstanceReports:
- Its purpose is to serve as the in-code representation of the fx.NiagaraMaxStatInstanceReports setting.
- It’s used directly in the NiagaraCommon module to enforce the instance limit when adding stat captures.
- The value is set through the CVar system, allowing for runtime adjustments.
- It interacts directly with the FNiagaraStatDatabase class, specifically in the AddStatCapture function.
- Developers should be aware that modifying GNiagaraMaxStatInstanceReports directly in code is not recommended; instead, they should use the CVar system to ensure consistency.
- Best practices include using this variable for read-only operations in code and relying on the CVar system for any value modifications.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraCommon.cpp:51
Scope: file
Source code excerpt:
int32 GNiagaraMaxStatInstanceReports = 20;
FAutoConsoleVariableRef CVarMaxStatInstanceReportss(
TEXT("fx.NiagaraMaxStatInstanceReports"),
GNiagaraMaxStatInstanceReports,
TEXT("The max number of different instances from which stat reports are aggregated."),
ECVF_Default);
static int32 GbMaxStatRecordedFrames = 30;
static FAutoConsoleVariableRef CVarMaxStatRecordedFrames(
#Associated Variable and Callsites
This variable is associated with another variable named GNiagaraMaxStatInstanceReports
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraCommon.cpp:49
Scope: file
Source code excerpt:
);
int32 GNiagaraMaxStatInstanceReports = 20;
FAutoConsoleVariableRef CVarMaxStatInstanceReportss(
TEXT("fx.NiagaraMaxStatInstanceReports"),
GNiagaraMaxStatInstanceReports,
TEXT("The max number of different instances from which stat reports are aggregated."),
ECVF_Default);
static int32 GbMaxStatRecordedFrames = 30;
static FAutoConsoleVariableRef CVarMaxStatRecordedFrames(
TEXT("fx.Niagara.MaxStatRecordedFrames"),
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraCommon.cpp:345
Scope (from outer to inner):
file
function void FNiagaraStatDatabase::AddStatCapture
Source code excerpt:
}
FScopeLock Lock(GetCriticalSection());
if (StatCaptures.Num() > GNiagaraMaxStatInstanceReports)
{
// we don't need data from too many emitter instances. If we already have enough, delete an old data point.
TArray<FStatReportKey> Keys;
StatCaptures.GetKeys(Keys);
StatCaptures.Remove(Keys[FMath::RandHelper(Keys.Num())]);
}