Umg widgets

From kevinpbuckley/VibeUE · View interactive version

Umg widgets is an AI agent skill from the GitHub repository kevinpbuckley/VibeUE. Create and modify UMG Widget Blueprints (UI) — build the widget hierarchy, set properties, style fonts/brushes, author widget animations, bind events, capture previews, run PIE checks, and wire MVVM ViewModels. Use when the user asks to create a UI/HUD/menu, add or arrange widgets (Button, TextBlock

How to use this skill

Skill file

🧠 Brains complement: IF an unreal-engine-skills-manager tool (external MCP) exists in this session, call it with {action: "load", skill: "umg-and-slate"} for UE domain knowledge on this topic — correct APIs, architecture, best practices — and treat it as the rubric for any review / "best practices" question. If no such tool is available (e.g. running under Claude Code or Codex without that MCP), skip this line entirely and proceed with this skill alone — do NOT attempt the call.

UMG Widget Blueprints Skill

This skill covers authoring Widget Blueprints (WBP) with WidgetService. Read the Critical Rules

below first — they prevent the most common failures. Then pick a task from the Task Index and load the

matching workflow doc and/or run the matching sample script.

Load the blueprints skill when you also need to add Blueprint variables, functions, or

components, and blueprint-graphs when wiring event-graph nodes for bound events.

Critical Rules

🚨 Creating Widget Blueprints — only one pattern works

WidgetService does not create the asset. Create it with the factory, then use WidgetService

to populate it:

import unreal
factory = unreal.WidgetBlueprintFactory()
factory.set_editor_property("parent_class", unreal.UserWidget)
asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
asset_tools.create_asset("MainMenu", "/Game/UI", unreal.WidgetBlueprint, factory)

Do not call BlueprintEditorLibrary.get_blueprint_class(), unreal.create_widget_blueprint(), or

WidgetService.create_widget() — none exist. (Runnable: scripts/create_widget.txt.)

🚨 Hierarchy: set the root first, parents before children

unreal.WidgetService.add_component(path, "CanvasPanel", "RootCanvas", "", True)   # empty parent -> becomes root
unreal.WidgetService.add_component(path, "Button", "PlayButton", "RootCanvas", False)

That 5th argument is is_variable, not set_as_root — a widget becomes the root because its parent

name is empty, not because of that flag. A 6th argument, child_index, inserts at a position instead of

appending; reorder_component moves an existing widget within its parent. See reference.md ▸ Child order.

⚠️ Widget names are unique per-blueprint, NOT per-parent. UMG enforces one name across the

whole Widget Blueprint, so you can't add an ItemLabel/ItemButton under each of Item1,

Item2, Item3. Suffix per-parent (Item1Label, Item2Label, …) — reusing a name silently

lands the component on the wrong parent or no-ops.

🚨 Property values are ALWAYS strings

unreal.WidgetService.set_property(path, "PlayText", "Font.Size", "24")  # "24", not 24

🚨 Color properties: FSlateColor vs FLinearColor — verify with a readback

ColorAndOpacity on text/image widgets is FSlateColor, whose export text is

"(SpecifiedColor=(R=1.0,G=0.5,B=0.0,A=1.0))" — a bare LinearColor string is auto-wrapped

into that form by set_property. ShadowColorAndOpacity is a plain FLinearColor:

"(R=0.0,G=0.0,B=0.0,A=1.0)". Named color strings ("red", "orange") and hex are NOT supported by

set_property — use set_color for those (below), or pass numeric linear RGBA.

Prefer set_property_verified over set_property. A struct set can return True while

writing nothing (UE struct import ignores unrecognized member names). set_property_verified

takes the same arguments and checks struct member names case-insensitively before writing.

An unknown member returns success=False and lists the valid names, even when the property

still has its default value. After a parse failure, new_value and changed report what UE

actually stored, including any partial write.

r = unreal.WidgetService.set_property_verified(path, "PlayButton", "Slot.Padding", "(Left=8,Top=8,Right=8,Bottom=8)")
if not r.success: print(r.message)          # also: r.changed, r.previous_value, r.new_value, r.property_type

Colours from design specs: set_color. Accepts "#E53935", "#E53935CC", "sRGB(229,57,53)",

"rgba(229,57,53,0.5)", basic names ("red", "orange", "grey"…), "linear(r,g,b[,a])" and the

"(R=..,G=..,B=..,A=..)" tuple. Hex/sRGB/names are converted to linear for you; it works on

FSlateColor, FLinearColor and FColor properties and is verified like set_property_verified:

unreal.WidgetService.set_color(path, "Title", "ColorAndOpacity", "#E53935")
unreal.WidgetService.set_color(path, "Title", "ShadowColorAndOpacity", "rgba(0,0,0,0.6)")

🚨 Building or rebuilding a whole tree — `build_layout` / `export_layout`

For more than a handful of widgets, describe the tree as JSON and build it in one call instead of

many add_component + set_property calls. The layout is validated first (unknown types, duplicate

names, children under non-panels, >1 child under Button/Border/SizeBox, unknown widget properties) and

nothing is written if it fails — run with dry_run=True to see every problem at once.

import json
layout = {"root": {"type": "CanvasPanel", "name": "Root", "is_variable": False, "children": [
    {"type": "VerticalBox", "name": "Menu", "slot": {"Position X": 100, "Position Y": 200}, "children": [
        {"type": "Button", "name": "PlayButton", "slot": {"Padding": 8}, "children": [
            {"type": "TextBlock", "name": "PlayLabel", "properties": {"Text": "Play", "Font.Size": 28}}]}]}]}}
r = unreal.WidgetService.build_layout(path, json.dumps(layout), "append", False)
print(r.success, r.widgets_created, r.properties_failed, list(r.errors))

aliases (Padding, Position X, HorizontalAlignment, LayoutData, …). Values may be strings,

numbers or booleans; is_variable defaults to true.

{"parent": "Menu", "children": [...]} to add below an existing panel.

Dry runs and writes both list graph or binding references that prevent dropping or retyping a widget.

properties_failed and listed in errors.

export_layout(path) follows panel children from the root and writes non-default editable values.

include_defaults=True also writes eligible default values. Both modes skip delegates, transient and

edit-const properties, and instanced object references such as navigation and accessibility settings.

Recreated widgets start with class defaults for omitted properties.

An ExpandableArea's header and body, a child user widget's named-slot content, and top-level inherited

slot content sit outside the panel hierarchy. Replace lists omitted widgets and refuses the request.

To intentionally discard that content, pass drop_unexported_widgets=True. Graph and binding checks

still apply. To restructure a panel layout, export it, edit the JSON, and dry-run the replacement first.

🚨 Use dedicated style APIs for full font/brush edits

Use set_font / set_brush (with WidgetFontInfo / WidgetBrushInfo) when changing a complete font

or brush — they keep related fields together. Use set_property only for single leaf values or slot

aliases like Position X, Size Y, Anchor Min X. See reference.md for every field name; runnable

examples in scripts/apply_font.txt and scripts/apply_brush.txt.

set_brush requires a slot_name: set_brush(widget_path, component_name, slot_name, brush_info)

(for an Image the slot is "Brush"). set_font takes an optional property_name that defaults to "Font".

⚠️ set_property("Font.Typeface", ...) silently returns False (size and color leaf-sets work,

but typeface/family do not go through the struct sub-property path). Always change typeface/family

via set_font with a WidgetFontInfo. Don't trust the True/False return of set_property on

nested struct sub-fields — read it back to confirm.

✅ set_font colour is now applied (ColorAndOpacity is an FSlateColor; the old path

silently no-op'd a bare (R=,G=,B=,A=) tuple). Pass a LINEAR tuple, e.g. (R=0.035,G=0.002,B=0.002,A=1);

set_font returns False and logs a Warning if a supplied colour did not land, so trust the return.

⚠️ get_font readback quirk (issue #470): the struct-typed string fields color,

shadow_color, and shadow_offset come back as two concatenated representations glued

together, e.g. shadow_offset == "(X=0.0,Y=0.0)(X=1.000000,Y=1.000000)". The trailing

parenthesized group is the real value. Scalar fields (size, typeface, font_family,

letter_spacing, outline_size) are clean. When verifying a font round-trip, parse the last

(...) group of these three fields (or compare scalars only) until #470 is fixed.

🚨 Override-gated properties (SizeBox width/height etc.)

set_editor_property("width_override", 34.0) on a USizeBox stores the value but leaves the paired

bOverride_WidthOverride edit-condition flag false — the override silently never applies (the value

even reads back as 34.0). Call the dedicated setters (set_width_override(), set_height_override(),

set_min_desired_width(), ...) which set flag + value together. Applies to any widget property gated

by a bOverride_* flag; after a raw property set, read the flag back before trusting the layout.

🚨 Animations require real property paths

add_animation_track / add_keyframe target actual widget properties or slot aliases

(RenderOpacity, ColorAndOpacity, Position X/Y, Size X/Y). Always create the animation first,

then the track, then keyframes. (Runnable: scripts/create_animation.txt.)

🚨 Preview vs PIE — different purposes

It now renders with a single gamma pass (an sRGB PNG matching the designer, no more double-gamma) and

a layout prepass (Overlay-centred content is centred, not bottom-aligned).

need a live instance.

🚨 Custom WBPs as components — discover first, pass the asset name

Use list_widget_blueprints("") to find existing WBPs, then pass just the asset name (e.g.

"WBP_HealthBar", not the full package path) as component_type. The child WBP must already exist;

circular references are rejected; the parent recompiles automatically.

🚨 Field-name gotchas (return objects)

| WRONG | CORRECT |

|-------|---------|

| p.name | p.property_name |

| p.type | p.property_type |

| p.property_value | p.current_value |

| w.component_name / w.name | w.widget_name |

| w.widget_type | w.widget_class |

WidgetInfo complete fields: widget_name, widget_class, parent_widget, is_root_widget, is_variable, children.

children is an Array[str] of widget NAMES, not nested objects. Iterating it and reading

.widget_name/.is_variable raises AttributeError: 'str' object has no attribute .... To walk

the tree, build a name→info map first:

infos = {w.widget_name: w for w in unreal.WidgetService.get_hierarchy(path)}
for child_name in infos["RootCanvas"].children:
    child = infos[child_name]          # look the child up by name
    print(child.widget_name, child.widget_class, child.is_variable)

get_widget_snapshot(path) returns full data (hierarchy + slot + all properties) for a valid

path — if it comes back empty, the path is wrong; do not conclude the widget is empty.

Full field tables for every return type are in reference.md.

🚨 Auditing widgets (best-practices review) — use these exact APIs

For "do our widgets follow best practices?" style audits:

entry (e.g. VisibilityDelegate, TextDelegate) with current_value of (null).None is

unbound — a function name there means a polling property binding exists.

list_graphs(path) → get_nodes_in_graph(path, "EventGraph") → find Event Tick →

get_node_pins(path, graph, node_id) and check each pin's connected flag. A Tick node with

no connected pins is just the default stub, not live logic.

get_functions, get_connected_nodes, unreal.find_class. Use list_graphs,

list_functions, get_nodes_in_graph, get_node_details (includes pin connections), and

unreal.load_class(None, path) instead.

Slot editing via `set_property`

set_property edits slot layout through these aliases (string values):

(pivot — set to 0.5 with anchors at 0.5 to truly center), ZOrder (or Z Order).

(values Fill/Left/Center/Right/Top/Bottom), Padding (one value or (Left=..,Top=..,Right=..,Bottom=..)),

Padding Left/Top/Right/Bottom, and on box slots Size Rule (Fill/Automatic) + Size Value.

unreal.WidgetService.set_property(path, "PlayButton", "ZOrder", "5")
unreal.WidgetService.set_property(path, "HeaderRow", "Vertical Alignment", "Top")
unreal.WidgetService.set_property(path, "HeaderRow", "Padding", "8")

Shadowed names prefer the WIDGET (fixed in issue #553). A name that exists on both a widget

and its slot (e.g. HorizontalAlignment on a Border sitting in an Overlay) now writes the

widget's own property; a log warning notes the ambiguity. To target the slot explicitly, prefix

with Slot. — e.g. set_property(path, "BackgroundBorder", "Slot.HorizontalAlignment", "Center")

(value aliases like Fill/Center still work behind the prefix). Names that exist only as slot

aliases (the lists above) keep resolving to the slot with no prefix needed.

Reparenting — `reparent_widget`

Move an existing widget to a new parent panel (preserves the widget object/GUID):

unreal.WidgetService.reparent_widget(path, "BackgroundImage", "MainContainer")

Rejects moving a panel into itself/a descendant; the root cannot be reparented.

Panel types

| Type | Purpose |

|------|---------|

| CanvasPanel | Absolute positioning (X, Y coords) |

| VerticalBox | Stack children vertically |

| HorizontalBox | Stack children horizontally |

| Overlay | Stack children on top of each other |


Task Index

Pick the task, load its workflow section, and/or run its sample script via execute_python_code.

Sample scripts under scripts/ are runnable examples — edit the variables at the top, then execute.

| Task | Workflow | Sample script (run via execute_python_code) |

|------|----------|-----------------------------------------------|

| Create a Widget Blueprint | workflows.md → Create Widget Blueprint | scripts/create_widget.txt |

| Build a menu (root + panel + buttons) | workflows.md → Build a Menu | scripts/build_menu.txt |

| Build / rebuild a whole tree from JSON | SKILL.md → build_layout / export_layout | — |

| Set a colour from hex / sRGB / a name | SKILL.md → Color properties (set_color) | — |

| Position widgets on a CanvasPanel | workflows.md → Canvas Positioning | — |

| Inspect a widget (hierarchy + properties) | workflows.md → Inspect a Widget | scripts/inspect_hierarchy.txt |

| Apply full font styling | workflows.md → Font Styling | scripts/apply_font.txt |

| Apply full brush styling | workflows.md → Brush Styling | scripts/apply_brush.txt |

| Author a widget animation | workflows.md → Widget Animation | scripts/create_animation.txt |

| Bind a widget event to a function | workflows.md → Bind Event | — |

| Rename / remove a widget | workflows.md → Edit the Hierarchy | — |

| Edit slot layout (z-order, alignment, padding) / reparent | SKILL.md → Slot editing | scripts/edit_slots.txt |

| Capture a preview PNG | workflows.md → Capture Preview | scripts/capture_preview.txt |

| Inspect a widget live in PIE | workflows.md → PIE Runtime Check | scripts/pie_inspect.txt |

| Add MVVM ViewModel + bindings | mvvm.md | scripts/mvvm_hud.txt |

Sub-docs

Load these only when the task needs them — read the sibling file directly under

Plugins/VibeUE/Content/Skills/umg-widgets/ (the engine AgentSkillToolset GetSkills is the

loader that exposes this skill; there is no vibeue-skills-manager tool):

FWidgetSlotInfo, FWidgetFontInfo, FWidgetBrushInfo, FWidgetAnimInfo, FWidgetPreviewResult,

FPIEWidgetHandle), the WidgetService action list, common properties, and event names.

add/bind/list/remove workflows.

Verification (do this before claiming success)

  1. After hierarchy edits: re-read with get_widget_snapshot(path) and confirm the expected widgets/parents.
  2. After property/style edits: read the value back (get_property / get_font / get_brush), or write

with set_property_verified / set_color, which do the read-back for you.

  1. Open/compile the WBP and confirm no errors, then unreal.EditorAssetLibrary.save_asset(path).

Never report a widget as created/configured until it appears in a fresh get_widget_snapshot result.

Additional gotchas

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.