Skip to main content

Editor Utility Widget

Base:
UEditorUtilityWidget
Type:
UNEditorUtilityWidget
Header File:
NexusUIEditor/Public/NEditorUtilityWidget.h

An extension on UEditorUtilityWidget that fills in three gaps in the stock implementation: tab presentation (custom icon and identifier), a deferred construct step that runs one frame after NativeConstruct so layout is finished, and integration with UNEditorUtilityWidgetSubsystem so widget state and tab placement survive editor sessions.

What It Does​

  • Tab Customization: TabIconStyle and TabIconName resolve to an FSlateIcon applied to the hosting SDockTab. bRemoveWorkspaceItem controls whether the tab can be re-spawned from the workspace menu after closing.
  • Deferred Construction: Schedules DelayedConstructTask via UAsyncEditorDelay to run one frame after NativeConstruct, so any widget state restored by the subsystem is applied after the layout has settled. This is also why UnitScale is only valid after the construction frame.
  • Persistent State: When bIsPersistent is true, the widget registers its UniqueIdentifier with UNEditorUtilityWidgetSubsystem on construct and pulls back any cached FNWidgetState. bHasPermanentState controls whether the cached state should be discarded when the host tab is closed.

Spawning In A Tab​

/**
* Spawn the editor utility widget asset found at ObjectPath inside its own dock tab.
* @param ObjectPath Object path to the UEditorUtilityWidgetBlueprint asset to spawn.
* @param Identifier Optional tab identifier override; defaults to NAME_None meaning the subsystem chooses one.
* @return The instantiated UEditorUtilityWidget hosted by the spawned tab, or nullptr on failure.
*/
static UEditorUtilityWidget* SpawnTab(const FString& ObjectPath, FName Identifier = NAME_None);

Use SpawnTab rather than constructing the widget directly when you want it docked alongside other editor tabs — the helper resolves the asset, opens a new SDockTab, and asks UNEditorUtilityWidgetSubsystem to record the tab/widget mapping for later restoration.

State API​

Is Persistent​

/** @return True when the widget opts in to cross-session state persistence via the widget subsystem. */
UFUNCTION(BlueprintCallable)
bool IsPersistent() const;

Get Unique Identifier​

/** @return The widget's stable identifier used as the key when storing/restoring persistent state. */
UFUNCTION(BlueprintCallable)
FName GetUniqueIdentifier() const;

Get Tab Identifier​

/** @return The tab identifier the widget was most recently hosted under, or NAME_None if not tabbed. */
UFUNCTION(BlueprintCallable)
FName GetTabIdentifier() const;

Class Defaults​

The following UPROPERTY fields are exposed for editing in any Blueprint subclass:

PropertyCategoryPurpose
bIsPersistentStateToggle persistent state tracking via UNEditorUtilityWidgetSubsystem.
bHasPermanentStateStateWhen false, cached state is discarded on tab close.
UniqueIdentifierStateStable FName key used by the subsystem to match this widget to its stored state.
TabIconStyleTabSlate style set that owns the tab icon brush (e.g. FNUIEditorStyle::GetStyleSetName()).
TabIconNameTabBrush name inside TabIconStyle to use as the dock tab icon.
bRemoveWorkspaceItemTabWhen true, the tab is removed from the workspace menu on close so it can't be re-spawned accidentally.
UnitScaleInfoFVector2D available after the construction frame; useful for scale-aware widget logic.
warning

UnitScale is only valid after DelayedConstructTask runs — i.e. one frame after NativeConstruct. Reading it during NativeConstruct returns the default FVector2D::One() rather than the actual scale.