FX.EarlyScheduleAsync
FX.EarlyScheduleAsync
#Overview
name: FX.EarlyScheduleAsync
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If 1, particle system components that can run async will be scheduled earlier in the frame
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of FX.EarlyScheduleAsync is to control the scheduling of asynchronous particle system components in the game frame. It is used to optimize the performance of particle effects in Unreal Engine 5.
This setting variable is primarily used in the particle system module of Unreal Engine’s runtime. Based on the callsites, it’s clear that this variable is part of the FX (Effects) system and specifically impacts the scheduling of particle components.
The value of this variable is set through a console variable (CVarFXEarlySchedule) with a default value of 0. It can be changed at runtime through console commands or programmatically.
FX.EarlyScheduleAsync interacts with the tick group settings of particle system components. When enabled (set to 1), it changes the tick group of particle components to run earlier in the frame.
Developers should be aware that enabling this variable will change the execution order of particle systems relative to other game systems. This could potentially impact gameplay or visual consistency if not properly accounted for.
Best practices when using this variable include:
- Testing thoroughly to ensure that early scheduling doesn’t cause visual artifacts or gameplay issues.
- Using it in conjunction with profiling tools to verify performance improvements.
- Being cautious when enabling it in existing projects, as it may change the behavior of particle effects.
Regarding the associated variable CVarFXEarlySchedule:
The purpose of CVarFXEarlySchedule is to provide a runtime-configurable way to control the FX.EarlyScheduleAsync setting. It’s an instance of TAutoConsoleVariable
This variable is used in the UParticleSystemComponent::TickComponent function to determine whether to change the tick group of particle components. When enabled, it sets the tick group to TG_PrePhysics and the end tick group to TG_PostPhysics.
Developers should be aware that changes to this variable will take effect immediately during runtime, potentially causing sudden changes in particle system behavior.
Best practices for CVarFXEarlySchedule include:
- Using it for performance testing and optimization.
- Considering its impact on the entire game frame when enabling or disabling it.
- Documenting its use and any associated performance impacts for the development team.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:5031
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarFXEarlySchedule(TEXT("FX.EarlyScheduleAsync"), 0, TEXT("If 1, particle system components that can run async will be scheduled earlier in the frame"));
static int32 GBatchParticleAsync = 0;
static FAutoConsoleVariableRef CVarBatchParticleAsync(
TEXT("FX.BatchAsync"),
GBatchParticleAsync,
TEXT("If 1, particle async tasks are batched because they often take less time than it takes to wake up a task thread. No effect on editor.")
#Associated Variable and Callsites
This variable is associated with another variable named CVarFXEarlySchedule
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:5031
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarFXEarlySchedule(TEXT("FX.EarlyScheduleAsync"), 0, TEXT("If 1, particle system components that can run async will be scheduled earlier in the frame"));
static int32 GBatchParticleAsync = 0;
static FAutoConsoleVariableRef CVarBatchParticleAsync(
TEXT("FX.BatchAsync"),
GBatchParticleAsync,
TEXT("If 1, particle async tasks are batched because they often take less time than it takes to wake up a task thread. No effect on editor.")
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:5584
Scope (from outer to inner):
file
function void UParticleSystemComponent::TickComponent
Source code excerpt:
#endif
if (CVarFXEarlySchedule.GetValueOnGameThread())
{
PrimaryComponentTick.TickGroup = TG_PrePhysics;
PrimaryComponentTick.EndTickGroup = TG_PostPhysics;
}
else
{