tick.AllowAsyncComponentTicks
tick.AllowAsyncComponentTicks
#Overview
name: tick.AllowAsyncComponentTicks
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Used to control async component ticks.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of tick.AllowAsyncComponentTicks is to control asynchronous component ticks in Unreal Engine 5. This setting variable is primarily used in the engine’s tick system, which is responsible for updating game objects and components over time.
The Unreal Engine subsystem that relies on this setting variable is the tick system, specifically the TickTaskManager module. This can be seen from the file location where the variable is defined and used: Engine/Source/Runtime/Engine/Private/TickTaskManager.cpp.
The value of this variable is set using a console variable (CVar) system. It is initialized with a default value of 1, meaning asynchronous component ticks are allowed by default. Developers can change this value at runtime using console commands or through code.
The associated variable CVarAllowAsyncComponentTicks interacts directly with tick.AllowAsyncComponentTicks. They share the same value and purpose. CVarAllowAsyncComponentTicks is used to retrieve the current value of the setting in the code.
Developers must be aware that this variable affects the performance and behavior of the tick system. Enabling asynchronous component ticks (value set to 1) can potentially improve performance by allowing component updates to occur in parallel, but it may also introduce synchronization complexities.
Best practices when using this variable include:
- Testing the game thoroughly with both enabled and disabled states to ensure correct behavior.
- Considering the impact on performance and synchronization when changing this value.
- Using it in conjunction with other tick-related settings for optimal performance tuning.
Regarding the associated variable CVarAllowAsyncComponentTicks:
The purpose of CVarAllowAsyncComponentTicks is to provide a programmatic way to access and modify the tick.AllowAsyncComponentTicks setting within the C++ code of Unreal Engine.
This variable is used directly in the TickTaskManager module to determine whether concurrent ticks should be allowed. It’s retrieved using the GetValueOnGameThread() method, which suggests that its value is intended to be accessed from the game thread for consistency.
The value of CVarAllowAsyncComponentTicks is set automatically based on the tick.AllowAsyncComponentTicks console variable. Changing one will affect the other.
Developers should be aware that this variable is used to control the behavior of the tick system at runtime. Its value determines whether the engine will attempt to perform component ticks asynchronously.
Best practices for using CVarAllowAsyncComponentTicks include:
- Using it to dynamically enable or disable async component ticks based on game state or performance requirements.
- Ensuring that any code relying on the synchronous execution of component ticks is properly synchronized when async ticks are enabled.
- Monitoring performance metrics when changing this value to understand its impact on your specific game.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TickTaskManager.cpp:45
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarAllowAsyncComponentTicks(
TEXT("tick.AllowAsyncComponentTicks"),
1,
TEXT("Used to control async component ticks."));
static TAutoConsoleVariable<int32> CVarAllowConcurrentQueue(
TEXT("tick.AllowConcurrentTickQueue"),
1,
#Associated Variable and Callsites
This variable is associated with another variable named CVarAllowAsyncComponentTicks
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TickTaskManager.cpp:44
Scope: file
Source code excerpt:
TEXT("When logging ticks, show the prerequistes; debugging."));
static TAutoConsoleVariable<int32> CVarAllowAsyncComponentTicks(
TEXT("tick.AllowAsyncComponentTicks"),
1,
TEXT("Used to control async component ticks."));
static TAutoConsoleVariable<int32> CVarAllowConcurrentQueue(
TEXT("tick.AllowConcurrentTickQueue"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TickTaskManager.cpp:593
Scope (from outer to inner):
file
class class FTickTaskSequencer
function void StartFrame
Source code excerpt:
else
{
bAllowConcurrentTicks = !!CVarAllowAsyncComponentTicks.GetValueOnGameThread();
}
WaitForCleanup();
for (int32 Index = 0; Index < TG_MAX; Index++)
{