$npx -y skills add teixasalone/UnrealEngine5-Skills --skill ue5-ui-umg-slateUE5.6/UE5.7 UI development workflow using UMG and Slate integration. Use when requests involve Widget Blueprint setup, Slate host widgets, lifecycle binding, input and focus handling, tooltip behavior, or viewport clamping logic.
| 1 | # Quick Start |
| 2 | - Identify whether feature belongs to UMG, Slate, or hybrid bridge. |
| 3 | - Define data source component/subsystem and UI binding point. |
| 4 | - Output widget tree intent and runtime binding sequence. |
| 5 | |
| 6 | # UE5.7 API Anchors |
| 7 | - UMG lifecycle and viewport anchors: |
| 8 | - `UUserWidget::NativeConstruct()`, `UUserWidget::NativeDestruct()` |
| 9 | - `UUserWidget::AddToViewport(...)` |
| 10 | - `UWidget::RemoveFromParent()` |
| 11 | - `UWidget::SetVisibility(...)` |
| 12 | - `UWidget::SetKeyboardFocus()` |
| 13 | - UMG input mode anchors: |
| 14 | - `UWidgetBlueprintLibrary::SetInputMode_UIOnlyEx(...)` |
| 15 | - `UWidgetBlueprintLibrary::SetInputMode_GameAndUIEx(...)` |
| 16 | - `UWidgetBlueprintLibrary::SetInputMode_GameOnly(...)` |
| 17 | - UMG/Slate bridge anchors: |
| 18 | - `UWidget::TakeWidget()` for Slate bridge hand-off |
| 19 | - `SCompoundWidget`, `SLATE_BEGIN_ARGS(...)` |
| 20 | - `FSlateApplication::SetKeyboardFocus(...)`, `SetUserFocus(...)` |
| 21 | - Viewport geometry anchor: |
| 22 | - `UGameViewportClient::GetViewportSize(...)` |
| 23 | |
| 24 | # UI Stage Contract |
| 25 | - Every UI task must define: |
| 26 | - UI layer ownership (UMG-only, Slate-only, or hybrid bridge) |
| 27 | - data source and update trigger (pull, push, event, or mixed) |
| 28 | - focus and input ownership transition |
| 29 | - viewport-safe placement behavior for tooltip/popup |
| 30 | - teardown/cleanup path for unbinds and widget removal |
| 31 | - If any item is missing, the UI implementation is incomplete. |
| 32 | |
| 33 | # Workflow |
| 34 | ## 1) UI Architecture Decision |
| 35 | - Select UMG for standard game HUD/menu work. |
| 36 | - Select Slate for custom rendering/input behavior that UMG cannot express cleanly. |
| 37 | - Select hybrid when a `UWidget` host needs to embed custom Slate content. |
| 38 | |
| 39 | ## 2) Construct and Lifetime |
| 40 | - Initialize widget bindings in construct/init path. |
| 41 | - Register event listeners once and store handles when required. |
| 42 | - Define destruct/unregister logic explicitly to avoid stale bindings. |
| 43 | |
| 44 | ## 3) Data Binding and Refresh |
| 45 | - Bind runtime data from one authoritative source (subsystem/component/view model). |
| 46 | - Use event-driven refresh for high-frequency data where possible. |
| 47 | - Keep display widgets read-only for gameplay state mutation. |
| 48 | |
| 49 | ## 4) Input and Focus Ownership |
| 50 | - Set input mode deliberately when opening/closing UI contexts. |
| 51 | - Set keyboard/user focus to intended root widget. |
| 52 | - Ensure focus return path back to gameplay on close. |
| 53 | |
| 54 | ## 5) Tooltip/Popup Viewport Clamp |
| 55 | - Compute desired tooltip position from anchor and cursor/widget geometry. |
| 56 | - Clamp final placement to viewport bounds to avoid off-screen rendering. |
| 57 | - Debounce high-frequency hover updates to avoid flicker. |
| 58 | |
| 59 | ## 6) Remove and Cleanup |
| 60 | - Remove widget from parent or viewport on close. |
| 61 | - Clear timers/delegates and transient references. |
| 62 | - Confirm no duplicate instances persist after reopen. |
| 63 | |
| 64 | # Constraints |
| 65 | - Keep UI rendering and gameplay state mutation separated. |
| 66 | - Avoid direct gameplay writes from passive display widgets. |
| 67 | - Clamp tooltip and popup placement to viewport bounds. |
| 68 | - Prefer deterministic input ownership and focus transitions. |
| 69 | - Keep Slate-only code isolated behind clear bridge boundaries. |
| 70 | - Do not rely on per-frame polling if event-driven updates are available. |
| 71 | |
| 72 | # Failure Handling |
| 73 | - Symptom: widget appears but never refreshes. |
| 74 | - Locate: construct timing, binding registration, source event firing. |
| 75 | - Fix: bind after source readiness and verify event subscription path. |
| 76 | - Symptom: widget refreshes once then stops. |
| 77 | - Locate: lost delegate handle or widget recreated without rebind. |
| 78 | - Fix: rebind on construct and unbind on destruct; prevent duplicate create/destroy churn. |
| 79 | - Symptom: input is swallowed by UI unexpectedly. |
| 80 | - Locate: current input mode and focused widget path. |
| 81 | - Fix: enforce intended input mode and set explicit focus target. |
| 82 | - Symptom: keyboard/controller navigation breaks after popup open. |
| 83 | - Locate: focus transfer and return path. |
| 84 | - Fix: store previous focus owner and restore on popup close. |
| 85 | - Symptom: tooltip flickers near screen edges. |
| 86 | - Locate: oscillating clamp output and hover source jitter. |
| 87 | - Fix: debounce hover updates and clamp with stable viewport metrics. |
| 88 | - Symptom: memory growth after repeated open/close. |
| 89 | - Locate: stale delegate/timer/reference retention. |
| 90 | - Fix: clear bindings and transient refs in teardown. |
| 91 | |
| 92 | # UE5.6 / UE5.7 Compatibility Notes |
| 93 | - UMG lifecycle, input mode, and Slate focus APIs listed above are stable in UE5.6/UE5.7. |
| 94 | - Prefer Enhanced Input + explicit UI input mode ownership in both versions. |
| 95 | |
| 96 | # Escalation |
| 97 | - Escalate when behavior requires engine-level Slate customization beyond project scope. |
| 98 | - Escalate when UI architecture conflicts with existing CommonUI framework decisions. |