Building UMG Widgets with the Agent
The UMG/Widgets toolsets let the agent author Widget Blueprints: create the widget asset, add and nest widgets, lay them out, and set properties — so you can describe a UI and get a working widget back.
What the agent can do
- Create Widget Blueprints (UserWidget) at a content path.
- Add widgets to the tree — panels (Canvas, Vertical/Horizontal Box, Overlay, Size Box), and leaf widgets (Text, Button, Image, Progress Bar, etc.).
- Nest and lay out widgets by parenting them and setting slot properties (alignment, padding, fill).
- Set widget properties — text, colors, fonts, brushes, sizes.
- Compile and save the Widget Blueprint so it can be created at runtime.
These are engine-reflected tools (Verb+Noun: create / add / set). Use
describe_toolset on the UMG/Widgets toolset for exact signatures.
Typical workflows
Build a simple HUD
"Create a Widget Blueprint
/Game/UI/WBP_HUD. Add a vertical box, then a Text labelledScore: 0and a Progress Bar under it. Compile it."
The agent creates the widget, builds the tree, sets the text, and compiles — ready to add to the viewport from your game code or another Blueprint.
Lay out a menu
"Add three buttons stacked vertically, each with a centered text label: Play, Options, Quit. Give them 8px padding."
Layout guidance (recommended defaults)
For clean, resolution-friendly UMG, prefer content-driven sizing over manual pixel placement:
- Use Size To Content / Auto on containers where possible instead of fixed Canvas slots.
- Enable Auto Wrap Text on text that can overflow.
- Prefer auto alignment (Fill / Center via box slots) over absolute Canvas offsets, so the layout adapts to different screen sizes.
Ask the agent to "size to content and auto-wrap" and it will favor box/overlay layouts over a hand-placed canvas.
Tips
- Choose the right container. Vertical/Horizontal Box for stacks, Overlay for layering, Canvas only when you truly need absolute positioning.
- Name your widgets. Give buttons/texts meaningful names so later edits ("set the Play button text to Start") are unambiguous.
- Compile and save. Adding widgets marks the asset dirty; have the agent compile and save before you use the widget.
Example via call_tool
{ "method": "tools/call", "params": {
"name": "call_tool",
"arguments": {
"tool": "AddWidget",
"args": {
"widgetBlueprint": "/Game/UI/WBP_HUD",
"widgetType": "TextBlock",
"parent": "RootVerticalBox",
"name": "ScoreText"
}
} } }
Tool/argument names are illustrative — confirm them with describe_toolset for
the UMG/Widgets toolset in your editor.