Slate.AccessibleWidgetsProcessedPerTick
Slate.AccessibleWidgetsProcessedPerTick
#Overview
name: Slate.AccessibleWidgetsProcessedPerTick
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
To reduce performance spikes, generating the accessible widget tree is limited to this many widgets per tick to update.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Slate.AccessibleWidgetsProcessedPerTick is to limit the number of accessible widgets processed per tick in the Slate UI framework. This setting is designed to reduce performance spikes by controlling the rate at which the accessible widget tree is generated and updated.
This setting variable is primarily used by the Slate accessibility system, which is part of the SlateCore module in Unreal Engine. Specifically, it is utilized in the FSlateAccessibleMessageHandler class, which handles accessibility-related tasks for the Slate UI system.
The value of this variable is set through an FAutoConsoleVariableRef, which means it can be adjusted at runtime via console commands or configuration files. By default, it is set to 100 widgets per tick.
The associated variable GAccessibleWidgetsProcessedPerTick directly interacts with Slate.AccessibleWidgetsProcessedPerTick. They share the same value, with GAccessibleWidgetsProcessedPerTick being the actual integer variable used in the code logic.
Developers should be aware that this variable affects the performance and responsiveness of the accessibility features in Slate UI. Setting it too low might cause delays in updating the accessible widget tree, while setting it too high could lead to performance spikes.
Best practices when using this variable include:
- Monitor performance metrics when adjusting this value to find the optimal balance between accessibility responsiveness and overall performance.
- Consider the complexity and number of accessible widgets in your UI when tuning this value.
- Test accessibility features thoroughly after making changes to ensure they still function correctly.
- Use profiling tools to measure the impact of different values on performance.
Regarding the associated variable GAccessibleWidgetsProcessedPerTick:
The purpose of GAccessibleWidgetsProcessedPerTick is to serve as the actual integer variable used in the code to control the number of accessible widgets processed per tick.
This variable is used directly in the FSlateAccessibleMessageHandler::Tick() function to limit the number of widgets processed in a single tick. It’s part of the SlateCore module and is crucial for the Slate UI accessibility system.
The value of GAccessibleWidgetsProcessedPerTick is set through the Slate.AccessibleWidgetsProcessedPerTick console variable, allowing for runtime adjustments.
Developers should be aware that modifying GAccessibleWidgetsProcessedPerTick directly in code is not recommended, as its value is controlled by the console variable. Instead, they should use the console variable to make adjustments.
Best practices for GAccessibleWidgetsProcessedPerTick are the same as those for Slate.AccessibleWidgetsProcessedPerTick, focusing on performance monitoring, testing, and finding the right balance for your specific UI needs.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/Widgets/Accessibility/SlateAccessibleMessageHandler.cpp:247
Scope: file
Source code excerpt:
int32 GAccessibleWidgetsProcessedPerTick = 100;
FAutoConsoleVariableRef AccessibleWidgetsProcessedPerTickRef(
TEXT("Slate.AccessibleWidgetsProcessedPerTick"),
GAccessibleWidgetsProcessedPerTick,
TEXT("To reduce performance spikes, generating the accessible widget tree is limited to this many widgets per tick to update.")
);
void FSlateAccessibleMessageHandler::Tick()
{
#Associated Variable and Callsites
This variable is associated with another variable named GAccessibleWidgetsProcessedPerTick
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/Widgets/Accessibility/SlateAccessibleMessageHandler.cpp:245
Scope: file
Source code excerpt:
}
int32 GAccessibleWidgetsProcessedPerTick = 100;
FAutoConsoleVariableRef AccessibleWidgetsProcessedPerTickRef(
TEXT("Slate.AccessibleWidgetsProcessedPerTick"),
GAccessibleWidgetsProcessedPerTick,
TEXT("To reduce performance spikes, generating the accessible widget tree is limited to this many widgets per tick to update.")
);
void FSlateAccessibleMessageHandler::Tick()
{
if (IsActive())
#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/Widgets/Accessibility/SlateAccessibleMessageHandler.cpp:272
Scope (from outer to inner):
file
function void FSlateAccessibleMessageHandler::Tick
Source code excerpt:
if (ToProcess.Num() > 0)
{
for (int32 Counter = 0; ToProcess.Num() > 0 && Counter < GAccessibleWidgetsProcessedPerTick; ++Counter)
{
FWidgetAndParent WidgetAndParent = ToProcess.Pop(EAllowShrinking::No);
if (WidgetAndParent.Widget.IsValid())
{
TSharedPtr<SWidget> SharedWidget = WidgetAndParent.Widget.Pin();
if (SharedWidget->CanChildrenBeAccessible())