Widget Editing
Edit UMG Widget Blueprint UI layouts via a text-based tree representation. The widget tree (visual hierarchy) uses the [WidgetTree] section. For editing the event graph and functions of a Widget Blueprint, use the unreal-blueprint-editing skill — Widget Blueprints are Blueprints, so EventGraph/Function/Variables sections work identically.
Prerequisite: UE editor running with UCP plugin enabled.
API
CDO: /Script/UnrealClientProtocolEditor.Default__NodeCodeEditingLibrary
| Function |
Params |
Description |
Outline |
AssetPath |
Returns all sections: [WidgetTree], [Variables], [EventGraph], [Function:Name], etc. |
ReadGraph |
AssetPath, Section |
Returns text. Use "WidgetTree" for the UI layout. |
WriteGraph |
AssetPath, Section, GraphText |
Overwrite the widget tree. |
Section Types for Widget Blueprints
A Widget Blueprint's Outline returns both widget tree and graph sections:
| Section |
Handler |
Description |
WidgetTree |
WidgetTreeSectionHandler |
UI widget hierarchy |
Variables |
BlueprintSectionHandler |
Blueprint variables |
EventGraph |
BlueprintSectionHandler |
Event graph logic |
Function:<Name> |
BlueprintSectionHandler |
Blueprint functions |
WidgetTree Text Format
The widget tree uses indentation-based text format where depth represents parent-child relationships:
[WidgetTree]
CanvasPanel_0: {"Type":"CanvasPanel"}
Image_BG: {"Type":"Image", "Slot":{"Anchors":"(Minimum=(X=0,Y=0),Maximum=(X=1,Y=1))", "Offsets":"(Left=0,Top=0,Right=0,Bottom=0)"}}
VerticalBox_Main: {"Type":"VerticalBox", "Slot":{"Anchors":"(Minimum=(X=0.5,Y=0.5),Maximum=(X=0.5,Y=0.5))"}}
TextBlock_Title: {"Type":"TextBlock", "Text":"Hello World", "Slot":{"HorizontalAlignment":"HAlign_Center"}}
Button_Submit: {"Type":"Button", "Slot":{"Padding":"(Left=0,Top=10,Right=0,Bottom=0)"}, "bIsVariable":true}
TextBlock_BtnLabel: {"Type":"TextBlock", "Text":"Submit"}
Format Rules
- Indentation = hierarchy: 2 spaces per level. Root widget has no indentation.
- Widget name is the key:
TextBlock_Title, Button_Submit, etc. These are the widget's GetName().
Type: Widget class name (e.g., CanvasPanel, TextBlock, Button, Image). Resolved via reflection.
Slot: Layout properties from the parent panel's slot type, as a nested JSON object.
bIsVariable: If true, the widget is accessible from the Blueprint graph (e.g., for binding events or setting properties at runtime). Only serialized when true.
- Other properties: Non-default widget properties, serialized via UE reflection.
Slot Properties by Panel Type
Different panel types use different slot types with different layout properties:
CanvasPanelSlot (parent is CanvasPanel):
LayoutData.Anchors: (Minimum=(X=0,Y=0),Maximum=(X=1,Y=1)) — anchor presets
LayoutData.Offsets: (Left=0,Top=0,Right=0,Bottom=0) — position/size offsets
LayoutData.Alignment: (X=0.5,Y=0.5) — pivot alignment
bAutoSize: true/false
ZOrder: integer
VerticalBoxSlot / HorizontalBoxSlot (parent is VerticalBox/HorizontalBox):
Padding: (Left=0,Top=10,Right=0,Bottom=0)
Size: (SizeRule=Fill,Value=1.0) or (SizeRule=Auto,Value=1.0)
HorizontalAlignment: HAlign_Fill, HAlign_Left, HAlign_Center, HAlign_Right
VerticalAlignment: VAlign_Fill, VAlign_Top, VAlign_Center, VAlign_Bottom
OverlaySlot (parent is Overlay):
Padding: (Left=0,Top=0,Right=0,Bottom=0)
HorizontalAlignment: same as above
VerticalAlignment: same as above
GridSlot (parent is GridPanel):
Row, Column: integer
RowSpan, ColumnSpan: integer
Common Widget Types
| Type |
Description |
Key Properties |
CanvasPanel |
Free-form positioning container |
(none typical) |
VerticalBox |
Stack children vertically |
(none typical) |
HorizontalBox |
Stack children horizontally |
(none typical) |
Overlay |
Stack children on top of each other |
(none typical) |
GridPanel |
Grid layout |
(none typical) |
ScrollBox |
Scrollable container |
Orientation |
SizeBox |
Constrain child size |
WidthOverride, HeightOverride |
Border |
Single child with background |
Background |
TextBlock |
Display text |
Text, Font, ColorAndOpacity |
RichTextBlock |
Rich text display |
Text |
Image |
Display image/texture |
Brush |
Button |
Clickable button |
WidgetStyle |
CheckBox |
Toggle checkbox |
IsChecked |
Slider |
Value slider |
Value, MinValue, MaxValue |
ProgressBar |
Progress indicator |
Percent |
EditableText |
Single-line text input |
Text, HintText |
EditableTextBox |
Single-line text input with box |
Text, HintText |
MultiLineEditableText |
Multi-line text input |
Text |
ComboBoxString |
Dropdown selection |
DefaultOptions |
SpinBox |
Numeric input |
Value, MinValue, MaxValue |
Spacer |
Empty spacing widget |
Size |
WidgetSwitcher |
Show one child at a time |
ActiveWidgetIndex |
Workflow
- Outline — see available sections (WidgetTree + graph sections)
- ReadGraph("WidgetTree") — get the UI hierarchy
- Understand the tree — indentation shows parent-child relationships
- Modify — add/remove/rearrange widgets, change properties
- WriteGraph("WidgetTree", text) — apply changes
For logic changes (event bindings, property updates at runtime):
- ReadGraph("EventGraph") — use the
unreal-blueprint-editing skill
- Reference widgets by name (widgets with
bIsVariable:true are accessible in graphs)
Key Rules
- Indentation matters: 2 spaces per level. Incorrect indentation will create wrong parent-child relationships.
- Widget names must be unique within the tree.
- Root widget (depth 0) must be a panel widget (CanvasPanel, VerticalBox, etc.).
- Only panel widgets can have children. Don't indent a child under a non-panel widget like TextBlock.
- Set
bIsVariable:true on any widget you need to reference from the Blueprint graph.
- ReadGraph before WriteGraph — always read first to understand the current structure.
- Slot properties depend on the parent panel type. A widget under VerticalBox uses VerticalBoxSlot properties, not CanvasPanelSlot.
- All operations support Undo (Ctrl+Z).
Error Handling
- Unknown widget class:
"Unknown widget class: ...".
- Failed to create widget:
"Failed to create widget: ...".
- Check
diff object in response for nodes_added, nodes_removed.
1---2name: unreal-widget-editing3description: Edit UMG Widget Blueprint UI layouts via text (ReadGraph/WriteGraph). Use when the user asks to add, remove, or rearrange UI widgets, change widget properties, or modify the visual hierarchy of a Widget Blueprint.4---56# Widget Editing78Edit UMG Widget Blueprint UI layouts via a text-based tree representation. The widget tree (visual hierarchy) uses the `[WidgetTree]` section. For editing the **event graph** and **functions** of a Widget Blueprint, use the `unreal-blueprint-editing` skill — Widget Blueprints are Blueprints, so EventGraph/Function/Variables sections work identically.910**Prerequisite**: UE editor running with UCP plugin enabled.1112## API1314CDO: `/Script/UnrealClientProtocolEditor.Default__NodeCodeEditingLibrary`1516| Function | Params | Description |17|----------|--------|-------------|18| `Outline` | `AssetPath` | Returns all sections: `[WidgetTree]`, `[Variables]`, `[EventGraph]`, `[Function:Name]`, etc. |19| `ReadGraph` | `AssetPath`, `Section` | Returns text. Use `"WidgetTree"` for the UI layout. |20| `WriteGraph` | `AssetPath`, `Section`, `GraphText` | Overwrite the widget tree. |2122## Section Types for Widget Blueprints2324A Widget Blueprint's Outline returns both widget tree and graph sections:2526| Section | Handler | Description |27|---------|---------|-------------|28| `WidgetTree` | WidgetTreeSectionHandler | UI widget hierarchy |29| `Variables` | BlueprintSectionHandler | Blueprint variables |30| `EventGraph` | BlueprintSectionHandler | Event graph logic |31| `Function:<Name>` | BlueprintSectionHandler | Blueprint functions |3233## WidgetTree Text Format3435The widget tree uses **indentation-based** text format where depth represents parent-child relationships:3637```38[WidgetTree]39CanvasPanel_0: {"Type":"CanvasPanel"}40 Image_BG: {"Type":"Image", "Slot":{"Anchors":"(Minimum=(X=0,Y=0),Maximum=(X=1,Y=1))", "Offsets":"(Left=0,Top=0,Right=0,Bottom=0)"}}41 VerticalBox_Main: {"Type":"VerticalBox", "Slot":{"Anchors":"(Minimum=(X=0.5,Y=0.5),Maximum=(X=0.5,Y=0.5))"}}42 TextBlock_Title: {"Type":"TextBlock", "Text":"Hello World", "Slot":{"HorizontalAlignment":"HAlign_Center"}}43 Button_Submit: {"Type":"Button", "Slot":{"Padding":"(Left=0,Top=10,Right=0,Bottom=0)"}, "bIsVariable":true}44 TextBlock_BtnLabel: {"Type":"TextBlock", "Text":"Submit"}45```4647### Format Rules4849- **Indentation = hierarchy**: 2 spaces per level. Root widget has no indentation.50- **Widget name is the key**: `TextBlock_Title`, `Button_Submit`, etc. These are the widget's `GetName()`.51- **`Type`**: Widget class name (e.g., `CanvasPanel`, `TextBlock`, `Button`, `Image`). Resolved via reflection.52- **`Slot`**: Layout properties from the parent panel's slot type, as a nested JSON object.53- **`bIsVariable`**: If `true`, the widget is accessible from the Blueprint graph (e.g., for binding events or setting properties at runtime). Only serialized when `true`.54- **Other properties**: Non-default widget properties, serialized via UE reflection.5556### Slot Properties by Panel Type5758Different panel types use different slot types with different layout properties:5960**CanvasPanelSlot** (parent is CanvasPanel):61- `LayoutData.Anchors`: `(Minimum=(X=0,Y=0),Maximum=(X=1,Y=1))` — anchor presets62- `LayoutData.Offsets`: `(Left=0,Top=0,Right=0,Bottom=0)` — position/size offsets63- `LayoutData.Alignment`: `(X=0.5,Y=0.5)` — pivot alignment64- `bAutoSize`: `true/false`65- `ZOrder`: integer6667**VerticalBoxSlot / HorizontalBoxSlot** (parent is VerticalBox/HorizontalBox):68- `Padding`: `(Left=0,Top=10,Right=0,Bottom=0)`69- `Size`: `(SizeRule=Fill,Value=1.0)` or `(SizeRule=Auto,Value=1.0)`70- `HorizontalAlignment`: `HAlign_Fill`, `HAlign_Left`, `HAlign_Center`, `HAlign_Right`71- `VerticalAlignment`: `VAlign_Fill`, `VAlign_Top`, `VAlign_Center`, `VAlign_Bottom`7273**OverlaySlot** (parent is Overlay):74- `Padding`: `(Left=0,Top=0,Right=0,Bottom=0)`75- `HorizontalAlignment`: same as above76- `VerticalAlignment`: same as above7778**GridSlot** (parent is GridPanel):79- `Row`, `Column`: integer80- `RowSpan`, `ColumnSpan`: integer8182### Common Widget Types8384| Type | Description | Key Properties |85|------|-------------|----------------|86| `CanvasPanel` | Free-form positioning container | (none typical) |87| `VerticalBox` | Stack children vertically | (none typical) |88| `HorizontalBox` | Stack children horizontally | (none typical) |89| `Overlay` | Stack children on top of each other | (none typical) |90| `GridPanel` | Grid layout | (none typical) |91| `ScrollBox` | Scrollable container | `Orientation` |92| `SizeBox` | Constrain child size | `WidthOverride`, `HeightOverride` |93| `Border` | Single child with background | `Background` |94| `TextBlock` | Display text | `Text`, `Font`, `ColorAndOpacity` |95| `RichTextBlock` | Rich text display | `Text` |96| `Image` | Display image/texture | `Brush` |97| `Button` | Clickable button | `WidgetStyle` |98| `CheckBox` | Toggle checkbox | `IsChecked` |99| `Slider` | Value slider | `Value`, `MinValue`, `MaxValue` |100| `ProgressBar` | Progress indicator | `Percent` |101| `EditableText` | Single-line text input | `Text`, `HintText` |102| `EditableTextBox` | Single-line text input with box | `Text`, `HintText` |103| `MultiLineEditableText` | Multi-line text input | `Text` |104| `ComboBoxString` | Dropdown selection | `DefaultOptions` |105| `SpinBox` | Numeric input | `Value`, `MinValue`, `MaxValue` |106| `Spacer` | Empty spacing widget | `Size` |107| `WidgetSwitcher` | Show one child at a time | `ActiveWidgetIndex` |108109## Workflow1101111. **Outline** — see available sections (WidgetTree + graph sections)1122. **ReadGraph("WidgetTree")** — get the UI hierarchy1133. **Understand the tree** — indentation shows parent-child relationships1144. **Modify** — add/remove/rearrange widgets, change properties1155. **WriteGraph("WidgetTree", text)** — apply changes116117For logic changes (event bindings, property updates at runtime):1181. **ReadGraph("EventGraph")** — use the `unreal-blueprint-editing` skill1192. Reference widgets by name (widgets with `bIsVariable:true` are accessible in graphs)120121## Key Rules1221231. **Indentation matters**: 2 spaces per level. Incorrect indentation will create wrong parent-child relationships.1242. **Widget names must be unique** within the tree.1253. **Root widget** (depth 0) must be a panel widget (CanvasPanel, VerticalBox, etc.).1264. **Only panel widgets** can have children. Don't indent a child under a non-panel widget like TextBlock.1275. **Set `bIsVariable:true`** on any widget you need to reference from the Blueprint graph.1286. **ReadGraph before WriteGraph** — always read first to understand the current structure.1297. **Slot properties** depend on the parent panel type. A widget under VerticalBox uses VerticalBoxSlot properties, not CanvasPanelSlot.1308. All operations support **Undo** (Ctrl+Z).131132## Error Handling133134- Unknown widget class: `"Unknown widget class: ..."`.135- Failed to create widget: `"Failed to create widget: ..."`.136- Check `diff` object in response for `nodes_added`, `nodes_removed`.