UMG.AnimationBudgetMs

UMG.AnimationBudgetMs

#Overview

name: UMG.AnimationBudgetMs

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 UMG.AnimationBudgetMs is to set an experimental per-frame animation budget for the evaluation of all UMG (Unreal Motion Graphics) animations in a frame. This setting variable is part of the UMG system, which is responsible for creating and managing user interfaces in Unreal Engine.

This setting variable is primarily used in the UMG module of Unreal Engine, specifically within the animation system for UI elements. Based on the callsites, it’s evident that the UMGSequenceTickManager relies on this variable.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files.

The variable interacts directly with its associated variable GAnimationBudgetMs. They share the same value, with GAnimationBudgetMs being the actual float variable used in the code, while UMG.AnimationBudgetMs is the console variable name used to set its value.

Developers must be aware that this is an experimental feature, as indicated by the comment in the code. The default value is 0.0, which likely means no budget limit by default. When using this variable, developers should carefully consider the performance implications of setting a non-zero value.

Best practices when using this variable include:

  1. Start with the default value (0.0) and only adjust if necessary.
  2. Monitor performance closely when adjusting this value.
  3. Use in conjunction with profiling tools to understand the impact on UI animation performance.
  4. Be cautious about setting too low a value, as it might negatively impact the smoothness of UI animations.

Regarding the associated variable GAnimationBudgetMs:

The purpose of GAnimationBudgetMs is to store the actual float value of the animation budget in milliseconds. It’s used directly in the code to control the animation budget.

This variable is used within the UMG module, specifically in the UMGSequenceTickManager class. It’s accessed in the ForceFlush function to determine the budget for flushing animations.

The value of GAnimationBudgetMs is set through the UMG.AnimationBudgetMs console variable. They are directly linked, with changes to the console variable immediately affecting GAnimationBudgetMs.

Developers should be aware that this variable directly affects the behavior of the UMGSequenceTickManager::ForceFlush function. Changes to this value will impact how animations are processed and potentially affect performance.

Best practices for GAnimationBudgetMs are similar to those for UMG.AnimationBudgetMs, as they are essentially the same value. Developers should monitor its usage in profiling tools and adjust cautiously based on performance needs.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Animation/UMGSequenceTickManager.cpp:34

Scope (from outer to inner):

file
namespace    UE::UMG

Source code excerpt:

	float GAnimationBudgetMs = 0.0f;
	FAutoConsoleVariableRef CVarAnimationBudgetMs(
		TEXT("UMG.AnimationBudgetMs"),
		GAnimationBudgetMs,
		TEXT("(Default: 0.0) EXPERIMENTAL: A per-frame animation budget to use for evaluation of all UMG animations this frame.")
	);
} // namespace UE::UMG

extern TAutoConsoleVariable<bool> CVarUserWidgetUseParallelAnimation;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Animation/UMGSequenceTickManager.cpp:32

Scope (from outer to inner):

file
namespace    UE::UMG

Source code excerpt:

	);

	float GAnimationBudgetMs = 0.0f;
	FAutoConsoleVariableRef CVarAnimationBudgetMs(
		TEXT("UMG.AnimationBudgetMs"),
		GAnimationBudgetMs,
		TEXT("(Default: 0.0) EXPERIMENTAL: A per-frame animation budget to use for evaluation of all UMG animations this frame.")
	);
} // namespace UE::UMG

extern TAutoConsoleVariable<bool> CVarUserWidgetUseParallelAnimation;

#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Animation/UMGSequenceTickManager.cpp:240

Scope (from outer to inner):

file
function     void UUMGSequenceTickManager::ForceFlush

Source code excerpt:

	if (Runner->IsAttachedToLinker())
	{
		Runner->Flush(UE::UMG::GAnimationBudgetMs);
		RunLatentActions();
	}
}

void UUMGSequenceTickManager::HandleSlatePostTick(float DeltaSeconds)
{