t.TickComponentLatentActionsWithTheComponent

t.TickComponentLatentActionsWithTheComponent

#Overview

name: t.TickComponentLatentActionsWithTheComponent

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of t.TickComponentLatentActionsWithTheComponent is to control when latent actions associated with components are ticked in relation to the component itself. This setting variable is part of Unreal Engine’s component system and affects the timing of latent action execution.

This setting variable is primarily used by the Engine module, specifically within the component system. It’s referenced in the ActorComponent.cpp file, which is a core part of Unreal Engine’s actor-component framework.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 and can be changed at runtime using the console command system.

The associated variable GTickComponentLatentActionsWithTheComponent interacts directly with t.TickComponentLatentActionsWithTheComponent. They share the same value, with the console variable (t.TickComponentLatentActionsWithTheComponent) controlling the int32 variable (GTickComponentLatentActionsWithTheComponent).

Developers must be aware that:

  1. This variable affects the timing of latent action execution for components.
  2. The behavior changed in Unreal Engine 4.16, with the default now being to tick component latent actions at the same time as the component.
  3. The old behavior (ticking latent actions later in the frame) is still available but may be removed in future engine versions.

Best practices when using this variable:

  1. Generally, use the default value (1) unless you have a specific reason not to.
  2. If your game relies on the pre-4.16 behavior, you can set it to 0, but be prepared to update your code in future engine versions.
  3. Be consistent across your project to avoid unexpected behavior differences between components.

Regarding the associated variable GTickComponentLatentActionsWithTheComponent:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/ActorComponent.cpp:79

Scope: file

Source code excerpt:

// Should we tick latent actions fired for a component at the same time as the component?
FAutoConsoleVariableRef GTickComponentLatentActionsWithTheComponentCVar(
	TEXT("t.TickComponentLatentActionsWithTheComponent"),
	GTickComponentLatentActionsWithTheComponent,
	TEXT("Should we tick latent actions fired for a component at the same time as the component?\n")
	TEXT(" 0: Tick component latent actions later on in the frame (behavior prior to 4.16, provided for games relying on the old behavior but will be removed in the future)\n")
	TEXT(" 1: Tick component latent actions at the same time as the component (default)"));

/** Enable to log out all render state create, destroy and updatetransform events */

#Associated Variable and Callsites

This variable is associated with another variable named GTickComponentLatentActionsWithTheComponent. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/ActorComponent.cpp:75

Scope: file

Source code excerpt:

// - Prior to 4.16, components behaved as if the value were 0, which meant their latent actions behaved differently to actors
//UE_DEPRECATED(4.16, "This CVar will be removed, with the behavior permanently changing in the future to always tick component latent actions along with the component")
int32 GTickComponentLatentActionsWithTheComponent = 1;

// Should we tick latent actions fired for a component at the same time as the component?
FAutoConsoleVariableRef GTickComponentLatentActionsWithTheComponentCVar(
	TEXT("t.TickComponentLatentActionsWithTheComponent"),
	GTickComponentLatentActionsWithTheComponent,
	TEXT("Should we tick latent actions fired for a component at the same time as the component?\n")
	TEXT(" 0: Tick component latent actions later on in the frame (behavior prior to 4.16, provided for games relying on the old behavior but will be removed in the future)\n")
	TEXT(" 1: Tick component latent actions at the same time as the component (default)"));

/** Enable to log out all render state create, destroy and updatetransform events */
#define LOG_RENDER_STATE 0

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/ActorComponent.cpp:1346

Scope (from outer to inner):

file
function     void UActorComponent::TickComponent

Source code excerpt:

		ReceiveTick(DeltaTime);

		if (GTickComponentLatentActionsWithTheComponent)
		{
			// Update any latent actions we have for this component, this will update even if paused if bUpdateWhilePaused is enabled
			// If this tick is skipped on a frame because we've got a TickInterval, our latent actions will be ticked
			// anyway by UWorld::Tick(). Given that, our latent actions don't need to be passed a larger
			// DeltaSeconds to make up the frames that they missed (because they wouldn't have missed any).
			// So pass in the world's DeltaSeconds value rather than our specific DeltaSeconds value.