bLoadWidgetsOnDedicatedServer

bLoadWidgetsOnDedicatedServer

#Overview

name: bLoadWidgetsOnDedicatedServer

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bLoadWidgetsOnDedicatedServer is to control whether UI widgets should be loaded on dedicated servers. This setting variable is primarily used for the user interface and widget systems in Unreal Engine 5.

The Unreal Engine subsystems and modules that rely on this setting variable include:

  1. CommonUI plugin
  2. UMG (Unreal Motion Graphics) module
  3. Engine module’s user interface settings

The value of this variable is set in the UUserInterfaceSettings class constructor in UserInterfaceSettings.cpp. By default, it is set to true.

This variable interacts with other parts of the engine, particularly in determining whether certain UI-related resources should be loaded on dedicated servers. It affects the behavior of functions like NeedsLoadForServer() in various UI-related classes.

Developers must be aware that:

  1. This setting can impact performance and memory usage on dedicated servers.
  2. It may affect the behavior of UI-related systems when running in a dedicated server environment.
  3. Changing this setting might require adjustments in how UI elements are handled in multiplayer scenarios.

Best practices when using this variable include:

  1. Consider setting it to false on dedicated servers that don’t require UI functionality to optimize performance.
  2. Ensure that any custom UI systems or widgets are designed to handle cases where this setting is false.
  3. Test thoroughly in both client and dedicated server environments to ensure proper functionality.
  4. Use this setting in conjunction with other server-specific optimizations for UI and rendering systems.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:1289, section: [/Script/Engine.UserInterfaceSettings]

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:243, section: [/Script/Engine.UserInterfaceSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Private/CommonInputBaseTypes.cpp:28

Scope (from outer to inner):

file
function     bool UCommonUIInputData::NeedsLoadForServer

Source code excerpt:

{
	const UUserInterfaceSettings* UISettings = GetDefault<UUserInterfaceSettings>();
	return UISettings->bLoadWidgetsOnDedicatedServer;
}

bool UCommonInputBaseControllerData::NeedsLoadForServer() const
{
	const UUserInterfaceSettings* UISettings = GetDefault<UUserInterfaceSettings>();
	return UISettings->bLoadWidgetsOnDedicatedServer;
}

bool UCommonInputBaseControllerData::TryGetInputBrush(FSlateBrush& OutBrush, const FKey& Key) const
{
	const FCommonInputKeyBrushConfiguration* DisplayConfig = InputBrushDataMap.FindByPredicate([&Key](const FCommonInputKeyBrushConfiguration& KeyBrushPair) -> bool
	{

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonButtonBase.cpp:46

Scope (from outer to inner):

file
function     bool UCommonButtonStyle::NeedsLoadForServer

Source code excerpt:

bool UCommonButtonStyle::NeedsLoadForServer() const
{
	return GetDefault<UUserInterfaceSettings>()->bLoadWidgetsOnDedicatedServer;
}

void UCommonButtonStyle::GetButtonPadding(FMargin& OutButtonPadding) const
{
	OutButtonPadding = ButtonPadding;
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/UserInterfaceSettings.h:203

Scope (from outer to inner):

file
class        class UUserInterfaceSettings : public UDeveloperSettings

Source code excerpt:

	 */
	UPROPERTY(config, EditAnywhere, Category = "Widgets")
	bool bLoadWidgetsOnDedicatedServer;

	/** 
	 * Setting to authorize or not automatic variable creation.
	 * If true, variables will be created automatically, if the type created allows it. Drawback: it's easier to have a bad data architecture because various blueprint graph will have access to many variables.
	 * If false, variables are never created automatically, and you have to create them manually on a case by case basis.
	 */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterfaceSettings.cpp:14

Scope (from outer to inner):

file
function     UUserInterfaceSettings::UUserInterfaceSettings

Source code excerpt:

	, RenderFocusRule(ERenderFocusRule::NavigationOnly)
	, ApplicationScale(1)
	, bLoadWidgetsOnDedicatedServer(true)
	, bAuthorizeAutomaticWidgetVariableCreation(true)
#if WITH_EDITORONLY_DATA
	, CustomFontDPI(FontConstants::RenderDPI)
	, FontDPIPreset(ConvertToEFontDPI(CustomFontDPI))
	, bUseCustomFontDPI(false)
#endif

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterfaceSettings.cpp:238

Scope (from outer to inner):

file
function     void UUserInterfaceSettings::ForceLoadResources

Source code excerpt:

	else if (IsRunningDedicatedServer())
	{
		bShouldLoadCursors = bLoadWidgetsOnDedicatedServer;
	}

	if (bShouldLoadCursors || bForceLoadEverything)
	{
		SCOPED_BOOT_TIMING("UUserInterfaceSettings::ForceLoadResources");

#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Components/Visual.cpp:28

Scope (from outer to inner):

file
function     bool UVisual::NeedsLoadForServer

Source code excerpt:

{
	const UUserInterfaceSettings* UISettings = GetDefault<UUserInterfaceSettings>();
	return UISettings->bLoadWidgetsOnDedicatedServer;
}

#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/WidgetBlueprintGeneratedClass.cpp:401

Scope (from outer to inner):

file
function     bool UWidgetBlueprintGeneratedClass::NeedsLoadForServer

Source code excerpt:

{
	const UUserInterfaceSettings* UISettings = GetDefault<UUserInterfaceSettings>();
	return UISettings->bLoadWidgetsOnDedicatedServer;
}

void UWidgetBlueprintGeneratedClass::SetWidgetTreeArchetype(UWidgetTree* InWidgetTree)
{
	WidgetTree = InWidgetTree;