Slate.InvalidationList.MaxArrayElements

Slate.InvalidationList.MaxArrayElements

#Overview

name: Slate.InvalidationList.MaxArrayElements

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 Slate.InvalidationList.MaxArrayElements is to control the preferred size of the elements array in the Slate invalidation system. This setting variable is part of Unreal Engine’s Slate UI framework, specifically related to the invalidation mechanism used for efficient UI updates.

The Slate invalidation system, which is part of the SlateCore module, relies on this setting variable. It is used in the FSlateInvalidationRoot class, which manages the invalidation of Slate widgets.

The value of this variable is set through an FAutoConsoleVariableRef, which allows it to be modified at runtime via console commands. The default value is 64, as seen in the code:

int32 GSlateInvalidationWidgetListMaxArrayElements = 64;

This variable interacts closely with another variable called GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting. Together, these variables control the behavior of the invalidation list.

Developers should be aware that this variable affects the memory usage and performance of the Slate invalidation system. A larger value may improve performance for UIs with many widgets, but it will also increase memory usage.

Best practices when using this variable include:

  1. Monitoring performance and memory usage to find the optimal value for your specific use case.
  2. Considering the complexity and size of your UI when adjusting this value.
  3. Testing thoroughly after making changes, as it can affect the behavior of the entire UI system.

Regarding the associated variable GSlateInvalidationWidgetListMaxArrayElements:

The purpose of GSlateInvalidationWidgetListMaxArrayElements is to store the actual value of the Slate.InvalidationList.MaxArrayElements setting. It is used directly in the code to initialize the FSlateInvalidationWidgetList.

This variable is part of the SlateCore module and is used in the implementation of the Slate invalidation system.

The value of this variable is set by the FAutoConsoleVariableRef, which links it to the console variable Slate.InvalidationList.MaxArrayElements.

It interacts directly with the console variable and is used in conjunction with GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting to configure the FSlateInvalidationWidgetList.

Developers should be aware that modifying this variable directly in code is not recommended, as it may be overwritten by the console variable. Instead, they should use the console variable to change its value.

Best practices for this variable include:

  1. Using the console variable to modify its value rather than changing it directly in code.
  2. Considering its impact on performance and memory usage when adjusting its value.
  3. Keeping it in sync with related variables like GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting for optimal performance.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/FastUpdate/SlateInvalidationRoot.cpp:147

Scope: file

Source code excerpt:

int32 GSlateInvalidationWidgetListMaxArrayElements = 64;
FAutoConsoleVariableRef CVarSlateInvalidationWidgetListMaxArrayElements(
	TEXT("Slate.InvalidationList.MaxArrayElements"),
	GSlateInvalidationWidgetListMaxArrayElements,
	TEXT("With the invalidation system, the preferred size of the elements array."));

int32 GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting = 40;
FAutoConsoleVariableRef CVarSlateInvalidationWidgetListNumElementLeftBeforeSplitting(
	TEXT("Slate.InvalidationList.NumberElementLeftBeforeSplitting"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/FastUpdate/SlateInvalidationRoot.cpp:145

Scope: file

Source code excerpt:



int32 GSlateInvalidationWidgetListMaxArrayElements = 64;
FAutoConsoleVariableRef CVarSlateInvalidationWidgetListMaxArrayElements(
	TEXT("Slate.InvalidationList.MaxArrayElements"),
	GSlateInvalidationWidgetListMaxArrayElements,
	TEXT("With the invalidation system, the preferred size of the elements array."));

int32 GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting = 40;
FAutoConsoleVariableRef CVarSlateInvalidationWidgetListNumElementLeftBeforeSplitting(
	TEXT("Slate.InvalidationList.NumberElementLeftBeforeSplitting"),
	GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting,

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/FastUpdate/SlateInvalidationRoot.cpp:216

Scope (from outer to inner):

file
function     FSlateInvalidationRoot::FSlateInvalidationRoot

Source code excerpt:

	FSlateApplicationBase::Get().OnInvalidateAllWidgets().AddRaw(this, &FSlateInvalidationRoot::HandleInvalidateAllWidgets);

	const FSlateInvalidationWidgetList::FArguments Arg = { GSlateInvalidationWidgetListMaxArrayElements, GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting };
	FastWidgetPathList = MakeUnique<FSlateInvalidationWidgetList>(InvalidationRootHandle, Arg);
	WidgetsNeedingPreUpdate = MakeUnique<FSlateInvalidationWidgetPreHeap>(*FastWidgetPathList);
	WidgetsNeedingPrepassUpdate = MakeUnique<FSlateInvalidationWidgetPrepassHeap>(*FastWidgetPathList);
	WidgetsNeedingPostUpdate = MakeUnique<FSlateInvalidationWidgetPostHeap>(*FastWidgetPathList);

#if WITH_SLATE_DEBUGGING