DefaultRootWidget
DefaultRootWidget
#Overview
name: DefaultRootWidget
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of DefaultRootWidget is to specify the default panel widget that will be placed at the root of all newly constructed widget blueprints in Unreal Engine’s UMG (Unreal Motion Graphics) system. This setting is part of the UMG Editor’s project settings, which are used to customize the behavior of the UMG Editor.
This setting variable is primarily relied upon by the UMG Editor subsystem, specifically within the widget blueprint creation process. It’s used in the WidgetBlueprintFactory when creating new widget blueprints.
The value of this variable is set in the UMG Editor Project Settings. It can be modified by developers through the project settings interface in the Unreal Engine editor.
DefaultRootWidget interacts with other variables and settings in the UMG Editor, such as bUseWidgetTemplateSelector. If bUseWidgetTemplateSelector is false, the DefaultRootWidget is used as the root widget for new widget blueprints.
Developers should be aware that this variable affects the initial structure of all newly created widget blueprints in their project. Changing this setting will not affect existing widget blueprints, only new ones created after the change.
Best practices when using this variable include:
- Choose a root widget that makes sense for the majority of your project’s UI needs.
- Consider leaving it as nullptr if you prefer to start with a blank canvas for each new widget blueprint.
- Ensure that the chosen DefaultRootWidget is a subclass of UPanelWidget.
- Communicate any changes to this setting with your team, as it can affect the workflow of UI designers and developers.
- If you have diverse UI needs, consider using the widget template selector (bUseWidgetTemplateSelector) instead of relying on a single default root widget.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEditor.ini:32, section: [/Script/UMGEditor.UMGEditorProjectSettings]
- INI Section:
/Script/UMGEditor.UMGEditorProjectSettings
- Raw value:
None
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/UMGEditor/Private/Settings/UMGEditorProjectSettings.cpp:38
Scope (from outer to inner):
file
function UUMGEditorProjectSettings::UUMGEditorProjectSettings
Source code excerpt:
UCanvasPanel::StaticClass()
};
DefaultRootWidget = nullptr;
FavoriteWidgetParentClasses.Add(UUserWidget::StaticClass());
}
#if WITH_EDITOR
FText UUMGEditorProjectSettings::GetSectionText() const
#Loc: <Workspace>/Engine/Source/Editor/UMGEditor/Private/WidgetBlueprintFactory.cpp:181
Scope (from outer to inner):
file
function UObject* UWidgetBlueprintFactory::FactoryCreateNew
Source code excerpt:
if (!GetDefault<UUMGEditorProjectSettings>()->bUseWidgetTemplateSelector)
{
RootWidgetClass = GetDefault<UUMGEditorProjectSettings>()->DefaultRootWidget;
}
UWidgetBlueprint* NewBP = CastChecked<UWidgetBlueprint>(FKismetEditorUtilities::CreateBlueprint(CurrentParentClass, InParent, Name, BlueprintType, UWidgetBlueprint::StaticClass(), UWidgetBlueprintGeneratedClass::StaticClass(), CallingContext));
// Create the desired root widget specified by the project
if ( NewBP->WidgetTree->RootWidget == nullptr )
#Loc: <Workspace>/Engine/Source/Editor/UMGEditor/Public/WidgetEditingProjectSettings.h:163
Scope (from outer to inner):
file
class class UWidgetEditingProjectSettings : public UDeveloperSettings
Source code excerpt:
/** The panel widget to place at the root of all newly constructed widget blueprints. Can be empty. */
UPROPERTY(EditAnywhere, config, Category = "Designer")
TSubclassOf<UPanelWidget> DefaultRootWidget;
/** Set true to filter all categories and widgets out in the palette, selectively enabling them later via permission lists. */
UPROPERTY(EditAnywhere, config, Category = "Designer")
bool bUseEditorConfigPaletteFiltering;
/** Enables a dialog that lets you select the parent class in a tree view. */