Navigation
API > API/Editor > API/Editor/UMGEditor > API/Editor/UMGEditor/FWidgetBlueprintOperationUtils
Description
Replaces a host widget with the content of one of its named slots, preserving parent linkage and root-widget wiring. Validates inputs and aborts without side effects on failure.
| Name | ReplaceWidgetWithNamedSlot |
| Type | function |
| Header File | /Engine/Source/Editor/UMGEditor/Public/WidgetBlueprintOperationUtils.h |
| Include Path | #include "WidgetBlueprintOperationUtils.h" |
| Source | /Engine/Source/Editor/UMGEditor/Private/WidgetBlueprintOperationUtils.cpp |
static bool ReplaceWidgetWithNamedSlot
(
UWidgetBlueprint * WidgetBlueprint,
UWidget * WidgetToReplace,
FName NamedSlot,
FWidgetBlueprintEditorUtils::EDeleteWidgetWarningType DeleteWarningType,
FText & OutErrorMessage
)
true on success, false if validation failed (no side effects on failure).
Parameters
| Name | Remarks |
|---|---|
| WidgetBlueprint | The widget blueprint containing the host widget. |
| WidgetToReplace | The host widget (must implement INamedSlotInterface and be in WidgetBlueprint's tree). |
| NamedSlot | The slot whose content will replace WidgetToReplace. |
| OutErrorMessage | Filled on failure with a description of what went wrong. |
| DeleteWarningType | Controls whether the user is prompted when the replaced host is referenced as a Blueprint variable. Defaults to DeleteSilently (suitable for headless / toolset callers); the editor menu path passes WarnAndAskUser. |