Navigation
API > API/Runtime > API/Runtime/UMG > API/Runtime/UMG/Blueprint
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UWidgetTree
References
| Module | UMG |
| Header | /Engine/Source/Runtime/UMG/Public/Blueprint/WidgetTree.h |
| Include | #include "Blueprint/WidgetTree.h" |
Syntax
class UWidgetTree :
public UObject,
public INamedSlotInterface
Remarks
The widget tree manages the collection of widgets in a blueprint widget.
Variables
| Type | Name | Description | |
|---|---|---|---|
| TArray< TObjectPtr< UWidget > > | AllWidgets | ||
| TMap< FName, TObjectPtr< UWidget > > | NamedSlotBindings | Stores the widgets being assigned to named slots, these widgets will be slotted into the named slots of the user widget that owns this widget tree after the user widget is constructed. | |
| TObjectPtr< UWidget > | RootWidget | The root widget of the tree |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UWidgetTree
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| WidgetT * | ConstructWidget
(
TSubclassOf< UWidget > WidgetClass, |
Constructs the widget, and adds it to the tree. | |
| int32 | FindChildIndex
(
const UPanelWidget* ParentWidget, |
Determines the child index of the given ParentWidget that the given ChildWidget ultimately occupies, accounting for nesting | |
| UWidget * | FindWidget
(
const FName& Name |
Finds the widget in the tree by name. | |
| UWidget * | FindWidget
(
TSharedRef< SWidget > InWidget |
Finds a widget in the tree using the native widget as the key. | |
| WidgetT * | FindWidget
(
const FName& Name |
Finds the widget in the tree by name and casts the return to the desired type. | |
| UWidget * | FindWidgetChild
(
UPanelWidget* ParentWidget, |
Searches recursively through the children of the given ParentWidget to find a child widget of the given name. | |
| UPanelWidget * | FindWidgetParent
(
UWidget* Widget, |
Gets the parent widget of a given widget, and potentially the child index. | |
| void | ForEachWidget
(
TFunctionRef< void(UWidget*)> Predicate |
Iterates through all widgets including widgets contained in named slots, other than investigating named slots, this code does not dive into foreign WidgetTrees, as would exist inside another user widget. | |
| void | ForEachWidgetAndDescendants
(
TFunctionRef< void(UWidget*)> Predicate |
Iterates through all widgets including widgets contained in named slots, other than investigating named slots. | |
| void | ForWidgetAndChildren
(
UWidget* Widget, |
Iterates through all child widgets including widgets contained in named slots, other than investigating named slots, this code does not dive into foreign WidgetTrees, as would exist inside another user widget. | |
| void | GetAllWidgets
(
TArray< UWidget* >& Widgets |
Gathers all the widgets in the tree recursively | |
| void | GetChildWidgets
(
UWidget* Parent, |
Gathers descendant child widgets of a parent widget. | |
| UWorld * | GetWorld () |
Begin UObject. | |
| bool | RemoveWidget
(
UWidget* Widget |
Removes the widget from the hierarchy and all sub widgets. | |
| bool | TryMoveWidgetToNewTree
(
UWidget* Widget, |
Attempts to move a constructed Widget to another tree. Returns true on a successful move. |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. | |
| void | PreSave
(
FObjectPreSaveContext SaveContext |
Presave function. |
Overridden from INamedSlotInterface
| Type | Name | Description | |
|---|---|---|---|
| UWidget * | GetContentForSlot
(
FName SlotName |
Gets the widget for a given slot by name, will return nullptr if no widget is in the slot. | |
| void | GetSlotNames
(
TArray< FName >& SlotNames |
Gets the names for slots that we can store widgets into. | |
| void | SetContentForSlot
(
FName SlotName, |
Sets the widget for a given slot by name. |