claude-code-arcane 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +104 -55
- package/agents/career/career-strategist.md +88 -0
- package/agents/career/cv-reviewer.md +81 -0
- package/agents/career/hiring-manager.md +68 -0
- package/agents/career/mock-interviewer.md +76 -0
- package/agents/freelance/client-screener.md +84 -0
- package/agents/freelance/discovery-call.md +65 -0
- package/agents/freelance/pipeline-strategist.md +99 -0
- package/agents/freelance/proposal-reviewer.md +82 -0
- package/agents/game/ue-blueprint-specialist.md +125 -0
- package/agents/game/ue-gas-specialist.md +133 -0
- package/agents/game/ue-umg-specialist.md +131 -0
- package/dist/cli.js +57 -13
- package/docs/RELEASE-SETUP.md +1 -1
- package/docs/SKILLS-CATALOG.md +67 -4
- package/docs/USER-GUIDE.md +77 -72
- package/docs/agent-hierarchy.md +21 -1
- package/docs/presentations/build_arcane_deck.py +2 -2
- package/docs/presentations/build_arcane_deck_12.py +2 -2
- package/hooks/detect-unreal.sh +90 -0
- package/package.json +2 -2
- package/profiles/freelance.yaml +43 -0
- package/profiles/job-hunt.yaml +5 -2
- package/profiles/unreal-dev.yaml +97 -0
- package/rules/drafter-reviewer.md +16 -3
- package/rules/freelance-guardrails.md +53 -0
- package/rules/gamedev/unreal-code.md +125 -0
- package/skills/career-registry/SKILL.md +95 -0
- package/skills/career-registry/scripts/career_registry.py +488 -0
- package/skills/client-screen/SKILL.md +83 -0
- package/skills/client-screen/references/red-flags.md +95 -0
- package/skills/cover-letter/SKILL.md +4 -3
- package/skills/cv-tailor/SKILL.md +11 -2
- package/skills/freelance-deliver/SKILL.md +90 -0
- package/skills/freelance-hunt/SKILL.md +126 -0
- package/skills/freelance-hunt/references/templates/Connects.md +39 -0
- package/skills/freelance-hunt/references/templates/Contrato.md +60 -0
- package/skills/freelance-hunt/references/templates/Propuesta.md +66 -0
- package/skills/freelance-kickoff/SKILL.md +94 -0
- package/skills/freelance-pipeline/SKILL.md +109 -0
- package/skills/freelance-pipeline/scripts/import_history.py +425 -0
- package/skills/freelance-profile/SKILL.md +93 -0
- package/skills/freelance-proposal/SKILL.md +112 -0
- package/skills/freelance-scan/SKILL.md +196 -0
- package/skills/freelance-scan/references/dedup.md +35 -0
- package/skills/freelance-scan/references/platforms.md +167 -0
- package/skills/freelance-scan/scripts/freelance_search.py +1077 -0
- package/skills/install-mcp/SKILL.md +135 -46
- package/skills/install-mcp/references/unreal-operations.md +55 -0
- package/skills/interview-prep/SKILL.md +11 -3
- package/skills/job-aplicar/SKILL.md +5 -1
- package/skills/job-hunt/SKILL.md +17 -0
- package/skills/job-outcome/SKILL.md +15 -1
- package/skills/job-upskill/SKILL.md +10 -2
- package/skills/ue-actor-component-architecture/SKILL.md +509 -0
- package/skills/ue-actor-component-architecture/references/actor-lifecycle.md +301 -0
- package/skills/ue-actor-component-architecture/references/component-types.md +592 -0
- package/skills/ue-ai-navigation/SKILL.md +526 -0
- package/skills/ue-ai-navigation/references/behavior-tree-patterns.md +392 -0
- package/skills/ue-ai-navigation/references/behavior-tree-workflow.md +107 -0
- package/skills/ue-ai-navigation/references/custom-bttask.md +104 -0
- package/skills/ue-ai-navigation/references/eqs-reference.md +423 -0
- package/skills/ue-animation-system/SKILL.md +521 -0
- package/skills/ue-animation-system/references/anim-notify-reference.md +486 -0
- package/skills/ue-animation-system/references/locomotion-setup.md +550 -0
- package/skills/ue-async-threading/SKILL.md +433 -0
- package/skills/ue-async-threading/references/thread-safety-guide.md +213 -0
- package/skills/ue-async-threading/references/threading-patterns.md +345 -0
- package/skills/ue-audio-system/SKILL.md +527 -0
- package/skills/ue-audio-system/references/audio-setup-patterns.md +700 -0
- package/skills/ue-blueprints/SKILL.md +134 -0
- package/skills/ue-blueprints/references/communication.md +82 -0
- package/skills/ue-character-movement/SKILL.md +475 -0
- package/skills/ue-character-movement/references/cmc-extension-patterns.md +335 -0
- package/skills/ue-character-movement/references/movement-pipeline.md +189 -0
- package/skills/ue-cpp-foundations/SKILL.md +533 -0
- package/skills/ue-cpp-foundations/references/components-and-gc.md +107 -0
- package/skills/ue-cpp-foundations/references/container-patterns.md +544 -0
- package/skills/ue-cpp-foundations/references/delegate-patterns.md +497 -0
- package/skills/ue-cpp-foundations/references/gameplay-classes-cpp.md +136 -0
- package/skills/ue-cpp-foundations/references/property-specifiers.md +306 -0
- package/skills/ue-data-assets-tables/SKILL.md +527 -0
- package/skills/ue-data-assets-tables/references/asset-loading-patterns.md +306 -0
- package/skills/ue-data-assets-tables/references/data-driven-design.md +378 -0
- package/skills/ue-editor-tools/SKILL.md +523 -0
- package/skills/ue-editor-tools/references/detail-customization-patterns.md +395 -0
- package/skills/ue-editor-tools/references/editor-module-setup.md +480 -0
- package/skills/ue-game-features/SKILL.md +477 -0
- package/skills/ue-game-features/references/experience-system.md +222 -0
- package/skills/ue-game-features/references/game-feature-patterns.md +308 -0
- package/skills/ue-gameplay-abilities/SKILL.md +518 -0
- package/skills/ue-gameplay-abilities/references/ability-task-reference.md +391 -0
- package/skills/ue-gameplay-abilities/references/gameplay-effect-reference.md +397 -0
- package/skills/ue-gameplay-abilities/references/gas-setup-patterns.md +369 -0
- package/skills/ue-gameplay-framework/SKILL.md +466 -0
- package/skills/ue-gameplay-framework/references/framework-class-map.md +243 -0
- package/skills/ue-input-system/SKILL.md +394 -0
- package/skills/ue-input-system/references/cpp-setup.md +131 -0
- package/skills/ue-input-system/references/enhanced-input-workflow.md +117 -0
- package/skills/ue-input-system/references/input-action-reference.md +731 -0
- package/skills/ue-mass-entity/SKILL.md +476 -0
- package/skills/ue-mass-entity/references/mass-entity-patterns.md +319 -0
- package/skills/ue-mass-entity/references/mass-fragment-reference.md +119 -0
- package/skills/ue-materials-rendering/SKILL.md +526 -0
- package/skills/ue-materials-rendering/references/material-parameter-reference.md +216 -0
- package/skills/ue-materials-rendering/references/post-process-settings.md +383 -0
- package/skills/ue-module-build-system/SKILL.md +487 -0
- package/skills/ue-module-build-system/references/build-cs-reference.md +418 -0
- package/skills/ue-module-build-system/references/common-build-errors.md +381 -0
- package/skills/ue-naming-conventions/SKILL.md +142 -0
- package/skills/ue-naming-conventions/references/asset-name-modifiers.md +233 -0
- package/skills/ue-naming-conventions/references/content-structure.md +83 -0
- package/skills/ue-networking-replication/SKILL.md +452 -0
- package/skills/ue-networking-replication/references/replication-patterns.md +526 -0
- package/skills/ue-networking-replication/references/rpc-decision-guide.md +393 -0
- package/skills/ue-niagara-effects/SKILL.md +531 -0
- package/skills/ue-niagara-effects/references/niagara-data-interfaces.md +491 -0
- package/skills/ue-niagara-effects/references/niagara-parameter-types.md +153 -0
- package/skills/ue-niagara-effects/references/niagara-workflow.md +115 -0
- package/skills/ue-packaging/SKILL.md +116 -0
- package/skills/ue-physics-collision/SKILL.md +423 -0
- package/skills/ue-physics-collision/references/collision-channel-setup.md +218 -0
- package/skills/ue-physics-collision/references/trace-patterns.md +499 -0
- package/skills/ue-procedural-generation/SKILL.md +505 -0
- package/skills/ue-procedural-generation/references/pcg-node-reference.md +381 -0
- package/skills/ue-procedural-generation/references/procedural-mesh-patterns.md +940 -0
- package/skills/ue-project-context/SKILL.md +305 -0
- package/skills/ue-sequencer-cinematics/SKILL.md +506 -0
- package/skills/ue-sequencer-cinematics/references/sequencer-patterns.md +629 -0
- package/skills/ue-serialization-savegames/SKILL.md +524 -0
- package/skills/ue-serialization-savegames/references/save-system-architecture.md +705 -0
- package/skills/ue-state-trees/SKILL.md +489 -0
- package/skills/ue-state-trees/references/state-tree-mass-integration.md +184 -0
- package/skills/ue-state-trees/references/state-tree-patterns.md +321 -0
- package/skills/ue-testing-debugging/SKILL.md +520 -0
- package/skills/ue-testing-debugging/references/automation-test-patterns.md +387 -0
- package/skills/ue-testing-debugging/references/profiling-commands.md +357 -0
- package/skills/ue-ui-umg-slate/SKILL.md +431 -0
- package/skills/ue-ui-umg-slate/references/common-ui-setup.md +484 -0
- package/skills/ue-ui-umg-slate/references/widget-types.md +487 -0
- package/skills/ue-world-level-streaming/SKILL.md +518 -0
- package/skills/ue-world-level-streaming/references/streaming-patterns.md +414 -0
- package/templates/gamedev/unreal-project-context.md +107 -0
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ue-ui-umg-slate
|
|
3
|
+
description: "UMG, Slate, UserWidget, HUD, BindWidget, Common UI, MVVM"
|
|
4
|
+
category: "gamedev"
|
|
5
|
+
argument-hint: "[widget o UI flow]"
|
|
6
|
+
user-invocable: true
|
|
7
|
+
allowed-tools: Read, Glob, Grep, Bash, Write, Edit
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# UE UI: UMG, Slate, and Common UI
|
|
11
|
+
|
|
12
|
+
You are an expert in Unreal Engine's UI systems (UMG, Slate, and Common UI).
|
|
13
|
+
|
|
14
|
+
Ask before writing: this skill edits widget classes and UMG assets. Propose the change and get approval before using Write or Edit.
|
|
15
|
+
|
|
16
|
+
## Context Check
|
|
17
|
+
|
|
18
|
+
Read `docs/unreal/project-context.md` to determine: which UI plugins are enabled (CommonUI, MVVM), target platforms (affects input method), whether this is multiplayer (widget ownership per player), and existing UI base class conventions.
|
|
19
|
+
|
|
20
|
+
## Information Gathering
|
|
21
|
+
|
|
22
|
+
Before writing UI code, confirm: UI type (HUD, full-screen menu, modal, in-world WidgetComponent), input requirements (mouse, gamepad, keyboard), target platforms, and widget lifecycle (persistent, transient, or pooled).
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 1. UUserWidget in C++
|
|
27
|
+
|
|
28
|
+
```cpp
|
|
29
|
+
// MyWidget.h
|
|
30
|
+
UCLASS()
|
|
31
|
+
class MYGAME_API UMyWidget : public UUserWidget
|
|
32
|
+
{
|
|
33
|
+
GENERATED_BODY()
|
|
34
|
+
protected:
|
|
35
|
+
virtual void NativeConstruct() override; // Bind delegates here — BindWidget refs valid
|
|
36
|
+
virtual void NativeDestruct() override;
|
|
37
|
+
virtual void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// MyWidget.cpp
|
|
41
|
+
void UMyWidget::NativeConstruct()
|
|
42
|
+
{
|
|
43
|
+
Super::NativeConstruct();
|
|
44
|
+
if (PlayButton)
|
|
45
|
+
PlayButton->OnClicked.AddDynamic(this, &UMyWidget::HandlePlayClicked);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Lifecycle and GC
|
|
50
|
+
|
|
51
|
+
```cpp
|
|
52
|
+
// Creation — always pass the owning PlayerController for player-UI
|
|
53
|
+
UMyWidget* Widget = CreateWidget<UMyWidget>(GetOwningPlayer(), MyWidgetClass);
|
|
54
|
+
Widget->AddToViewport(0); // ZOrder: higher = on top. Roots the widget (won't GC).
|
|
55
|
+
Widget->AddToPlayerScreen(0); // Split-screen: ties to a specific player's viewport region
|
|
56
|
+
Widget->RemoveFromParent(); // Un-roots — may be GC'd if no UPROPERTY holds it.
|
|
57
|
+
|
|
58
|
+
UPROPERTY() TObjectPtr<UMyWidget> CachedWidget; // Strong ref keeps alive after RemoveFromParent
|
|
59
|
+
|
|
60
|
+
// Visibility
|
|
61
|
+
Widget->SetVisibility(ESlateVisibility::Collapsed); // Not drawn, takes no space
|
|
62
|
+
Widget->SetVisibility(ESlateVisibility::Hidden); // Not drawn, takes space
|
|
63
|
+
Widget->SetVisibility(ESlateVisibility::Visible); // Drawn, receives input
|
|
64
|
+
// HitTestInvisible: drawn, passes input through; SelfHitTestInvisible: children receive input
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 2. BindWidget Pattern
|
|
70
|
+
|
|
71
|
+
```cpp
|
|
72
|
+
UCLASS()
|
|
73
|
+
class MYGAME_API UMyWidget : public UUserWidget
|
|
74
|
+
{
|
|
75
|
+
GENERATED_BODY()
|
|
76
|
+
protected:
|
|
77
|
+
UPROPERTY(meta=(BindWidget)) // Required — compiler warning if absent in UMG BP
|
|
78
|
+
TObjectPtr<UButton> PlayButton;
|
|
79
|
+
|
|
80
|
+
UPROPERTY(meta=(BindWidgetOptional)) // Optional — always null-check before use
|
|
81
|
+
TObjectPtr<UTextBlock> SubtitleText;
|
|
82
|
+
|
|
83
|
+
UPROPERTY(meta=(BindWidgetAnim), Transient) // Transient is required for anim bindings
|
|
84
|
+
TObjectPtr<UWidgetAnimation> IntroAnim;
|
|
85
|
+
|
|
86
|
+
UPROPERTY(meta=(BindWidget)) TObjectPtr<UTextBlock> ScoreText;
|
|
87
|
+
UPROPERTY(meta=(BindWidget)) TObjectPtr<UImage> PlayerAvatar;
|
|
88
|
+
UPROPERTY(meta=(BindWidget)) TObjectPtr<UProgressBar> HealthBar;
|
|
89
|
+
UPROPERTY(meta=(BindWidget)) TObjectPtr<UListView> ItemList;
|
|
90
|
+
UPROPERTY(meta=(BindWidget)) TObjectPtr<UScrollBox> ContentScroll; // Scrollable container
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Name must match the UMG Blueprint widget name exactly (case-sensitive). Always null-check optional bindings.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 3. Widget Interaction
|
|
99
|
+
|
|
100
|
+
### UButton (Button.h)
|
|
101
|
+
|
|
102
|
+
```cpp
|
|
103
|
+
// Delegates: OnClicked, OnPressed, OnReleased, OnHovered, OnUnhovered
|
|
104
|
+
PlayButton->OnClicked.AddDynamic(this, &UMyWidget::HandlePlayClicked);
|
|
105
|
+
PlayButton->OnHovered.AddDynamic(this, &UMyWidget::HandlePlayHovered);
|
|
106
|
+
PlayButton->SetColorAndOpacity(FLinearColor(1.f, 0.8f, 0.f, 1.f));
|
|
107
|
+
PlayButton->SetIsEnabled(false);
|
|
108
|
+
// UE5.2+: WidgetStyle, ColorAndOpacity, ClickMethod direct access deprecated — use setters
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### UTextBlock (TextBlock.h)
|
|
112
|
+
|
|
113
|
+
```cpp
|
|
114
|
+
// SetText wipes any Blueprint binding on Text
|
|
115
|
+
ScoreText->SetText(FText::Format(NSLOCTEXT("HUD", "ScoreFmt", "Score: {0}"), FText::AsNumber(Score)));
|
|
116
|
+
ScoreText->SetColorAndOpacity(FSlateColor(FLinearColor::White));
|
|
117
|
+
ScoreText->SetTextTransformPolicy(ETextTransformPolicy::ToUpper);
|
|
118
|
+
ScoreText->SetTextOverflowPolicy(ETextOverflowPolicy::Ellipsis);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### UImage (Image.h)
|
|
122
|
+
|
|
123
|
+
```cpp
|
|
124
|
+
PlayerAvatar->SetBrushFromTexture(AvatarTexture, /*bMatchSize=*/false);
|
|
125
|
+
PlayerAvatar->SetBrushFromMaterial(IconMaterial);
|
|
126
|
+
UMaterialInstanceDynamic* MID = PlayerAvatar->GetDynamicMaterial();
|
|
127
|
+
MID->SetScalarParameterValue(TEXT("Opacity"), 0.5f);
|
|
128
|
+
PlayerAvatar->SetBrushFromSoftTexture(SoftTextureRef, false); // Async stream
|
|
129
|
+
PlayerAvatar->SetColorAndOpacity(FLinearColor(1.f, 1.f, 1.f, 0.5f));
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### UProgressBar (ProgressBar.h)
|
|
133
|
+
|
|
134
|
+
```cpp
|
|
135
|
+
HealthBar->SetPercent(CurrentHealth / MaxHealth); // 0.0–1.0
|
|
136
|
+
HealthBar->SetFillColorAndOpacity(FLinearColor(0.f, 1.f, 0.f, 1.f));
|
|
137
|
+
LoadingBar->SetIsMarquee(true); // Indeterminate animation
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### UScrollBox (ScrollBox.h)
|
|
141
|
+
|
|
142
|
+
`UScrollBox` is a BindWidget-compatible container for scrollable content. Supports vertical and horizontal scroll. Add child widgets in Blueprint; query or modify scroll offset in C++:
|
|
143
|
+
|
|
144
|
+
```cpp
|
|
145
|
+
ContentScroll->ScrollToEnd();
|
|
146
|
+
ContentScroll->SetScrollOffset(0.f);
|
|
147
|
+
ContentScroll->SetOrientation(Orient_Vertical); // default
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### UListView + UTileView + IUserObjectListEntry (ListView.h, TileView.h, IUserObjectListEntry.h)
|
|
151
|
+
|
|
152
|
+
`UListView` — virtualised vertical list. `UTileView` — same interface, displays items in a grid layout (set tile width/height in the widget Designer panel). Both use `IUserObjectListEntry`.
|
|
153
|
+
|
|
154
|
+
```cpp
|
|
155
|
+
// Entry widget must implement the interface
|
|
156
|
+
UCLASS()
|
|
157
|
+
class UItemEntryWidget : public UUserWidget, public IUserObjectListEntry
|
|
158
|
+
{
|
|
159
|
+
GENERATED_BODY()
|
|
160
|
+
UPROPERTY(meta=(BindWidget)) TObjectPtr<UTextBlock> NameText;
|
|
161
|
+
protected:
|
|
162
|
+
virtual void NativeOnListItemObjectSet(UObject* ListItemObject) override
|
|
163
|
+
{
|
|
164
|
+
IUserObjectListEntry::NativeOnListItemObjectSet(ListItemObject);
|
|
165
|
+
if (UItemData* Data = Cast<UItemData>(ListItemObject))
|
|
166
|
+
NameText->SetText(FText::FromString(Data->ItemName));
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// Populate
|
|
171
|
+
ItemList->ClearListItems();
|
|
172
|
+
for (const FItemInfo& Info : Items)
|
|
173
|
+
{
|
|
174
|
+
UItemData* Data = NewObject<UItemData>(this);
|
|
175
|
+
Data->ItemName = Info.Name;
|
|
176
|
+
ItemList->AddItem(Data);
|
|
177
|
+
}
|
|
178
|
+
// Selection — NOTE: BP_OnItemClicked is Blueprint-only and private.
|
|
179
|
+
// For C++: override NativeOnItemClicked in a UListView subclass, or bind
|
|
180
|
+
// OnItemClickedInternal (protected delegate on UListViewBase).
|
|
181
|
+
UItemData* Selected = ItemList->GetSelectedItem<UItemData>();
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 4. Input Mode Management
|
|
187
|
+
|
|
188
|
+
```cpp
|
|
189
|
+
// UI-only — full-screen menus. Game input blocked.
|
|
190
|
+
FInputModeUIOnly UIMode;
|
|
191
|
+
UIMode.SetWidgetToFocus(Widget->TakeWidget());
|
|
192
|
+
GetOwningPlayer()->SetInputMode(UIMode);
|
|
193
|
+
GetOwningPlayer()->SetShowMouseCursor(true);
|
|
194
|
+
|
|
195
|
+
// Game-only — restore gameplay.
|
|
196
|
+
GetOwningPlayer()->SetInputMode(FInputModeGameOnly());
|
|
197
|
+
GetOwningPlayer()->SetShowMouseCursor(false);
|
|
198
|
+
|
|
199
|
+
// Game and UI — HUD tooltips, keeps game input active.
|
|
200
|
+
FInputModeGameAndUI GameUIMode;
|
|
201
|
+
GameUIMode.SetLockMouseToViewportBehavior(EMouseLockMode::LockOnCapture);
|
|
202
|
+
GetOwningPlayer()->SetInputMode(GameUIMode);
|
|
203
|
+
GetOwningPlayer()->SetShowMouseCursor(true);
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Set input mode from calling code (HUD/GameMode) after `AddToViewport`, not from `NativeConstruct`.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 5. Common UI (Plugin)
|
|
211
|
+
|
|
212
|
+
See `references/common-ui-setup.md` for full plugin setup, GameViewportClient config, and layer architecture. Enable `CommonUI` and `CommonInput` plugins. Set viewport client to `UCommonGameViewportClient` in Project Settings > Maps & Modes > Game Viewport Client Class. `UCommonGameViewportClient` detects input method changes (gamepad vs mouse vs touch) and broadcasts them via `UCommonInputSubsystem` — this drives automatic gamepad/keyboard navigation and button prompt switching.
|
|
213
|
+
|
|
214
|
+
### UCommonActivatableWidget (CommonActivatableWidget.h)
|
|
215
|
+
|
|
216
|
+
```cpp
|
|
217
|
+
UCLASS()
|
|
218
|
+
class MYGAME_API UMyMenuScreen : public UCommonActivatableWidget
|
|
219
|
+
{
|
|
220
|
+
GENERATED_BODY()
|
|
221
|
+
protected:
|
|
222
|
+
virtual void NativeOnActivated() override;
|
|
223
|
+
virtual void NativeOnDeactivated() override;
|
|
224
|
+
virtual UWidget* NativeGetDesiredFocusTarget() const override { return CloseButton; }
|
|
225
|
+
virtual TOptional<FUIInputConfig> GetDesiredInputConfig() const override
|
|
226
|
+
{
|
|
227
|
+
return FUIInputConfig(ECommonInputMode::Menu, EMouseCaptureMode::NoCapture);
|
|
228
|
+
}
|
|
229
|
+
UPROPERTY(meta=(BindWidget)) TObjectPtr<UCommonButtonBase> CloseButton;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
void UMyMenuScreen::NativeOnActivated()
|
|
233
|
+
{
|
|
234
|
+
Super::NativeOnActivated(); // Always call Super
|
|
235
|
+
CloseButton->OnClicked().AddUObject(this, &UMyMenuScreen::DeactivateWidget);
|
|
236
|
+
}
|
|
237
|
+
void UMyMenuScreen::NativeOnDeactivated()
|
|
238
|
+
{
|
|
239
|
+
CloseButton->OnClicked().RemoveAll(this);
|
|
240
|
+
Super::NativeOnDeactivated(); // Always call Super
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Widget Containers (CommonActivatableWidgetContainerBase.h)
|
|
245
|
+
|
|
246
|
+
`UCommonActivatableWidgetContainerBase` is the base class for Common UI widget containers. Two concrete subclasses:
|
|
247
|
+
|
|
248
|
+
- **`UCommonActivatableWidgetStack`** — shows only the topmost widget; deactivating reveals the previous one (stack behaviour). This is the correct stack class — do NOT use `UCommonActivatableWidgetSwitcher` here, which inherits from `UCommonAnimatedSwitcher`/`UWidgetSwitcher` and is a different widget entirely.
|
|
249
|
+
- **`UCommonActivatableWidgetQueue`** — FIFO queue; displays widgets sequentially, advancing to the next when the current deactivates.
|
|
250
|
+
|
|
251
|
+
```cpp
|
|
252
|
+
UPROPERTY(meta=(BindWidget)) TObjectPtr<UCommonActivatableWidgetStack> MenuLayer;
|
|
253
|
+
UPROPERTY(meta=(BindWidget)) TObjectPtr<UCommonActivatableWidgetQueue> NotificationQueue;
|
|
254
|
+
|
|
255
|
+
// Push screen onto the stack — AddWidget creates the widget internally
|
|
256
|
+
UMyMenuScreen* Screen = Cast<UMyMenuScreen>(MenuLayer->AddWidget(UMyMenuScreen::StaticClass()));
|
|
257
|
+
Screen->ActivateWidget();
|
|
258
|
+
|
|
259
|
+
// Go back — deactivate re-activates the previous widget in the stack
|
|
260
|
+
Screen->DeactivateWidget();
|
|
261
|
+
|
|
262
|
+
// Queue a notification — plays after the current one finishes
|
|
263
|
+
NotificationQueue->AddWidget(UMyNotificationWidget::StaticClass());
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### UCommonButtonBase
|
|
267
|
+
|
|
268
|
+
Uses `FCommonButtonEvent` (declared via `DECLARE_EVENT`) — use `AddUObject`, not `AddDynamic`:
|
|
269
|
+
```cpp
|
|
270
|
+
MyButton->OnClicked().AddUObject(this, &UMyScreen::HandleClick);
|
|
271
|
+
MyButton->OnClicked().RemoveAll(this); // In NativeOnDeactivated
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### UCommonUIActionRouter
|
|
275
|
+
|
|
276
|
+
Handles input routing between game and UI layers; Common UI drives it automatically via `GetDesiredInputConfig`. Access directly when you need to query the current input mode:
|
|
277
|
+
|
|
278
|
+
```cpp
|
|
279
|
+
#include "Input/CommonUIActionRouterBase.h"
|
|
280
|
+
// Get() takes a const UWidget& — call from within a widget (or pass any valid UWidget in scope):
|
|
281
|
+
UCommonUIActionRouterBase* Router = UCommonUIActionRouterBase::Get(*ContextWidget); // ContextWidget: const UWidget&
|
|
282
|
+
if (Router) { /* query active input config */ }
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Gamepad / Keyboard Navigation
|
|
286
|
+
|
|
287
|
+
Common UI provides automatic gamepad and keyboard navigation without extra setup. Key behaviours:
|
|
288
|
+
|
|
289
|
+
- `UCommonButtonBase` highlights automatically when it receives focus via D-pad or Tab navigation.
|
|
290
|
+
- `UCommonActivatableWidget::NativeGetDesiredFocusTarget()` controls which widget receives focus when the screen activates.
|
|
291
|
+
- When a widget deactivates, Common UI restores focus to the widget that was active before it opened — no manual focus bookkeeping required.
|
|
292
|
+
- Bind `GetDesiredInputConfig` to `ECommonInputMode::Menu` to suppress game input while a menu is open.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## 6. Slate Fundamentals
|
|
297
|
+
|
|
298
|
+
Use Slate for editor extensions, custom renderers, or when UMG doesn't expose required functionality.
|
|
299
|
+
|
|
300
|
+
`SWidget` is the abstract base of all Slate widgets. `SCompoundWidget` (shown below) is the typical subclass for custom widgets.
|
|
301
|
+
|
|
302
|
+
```cpp
|
|
303
|
+
// Custom widget — SMyWidget.h
|
|
304
|
+
class SMyWidget : public SCompoundWidget
|
|
305
|
+
{
|
|
306
|
+
public:
|
|
307
|
+
SLATE_BEGIN_ARGS(SMyWidget)
|
|
308
|
+
: _LabelText(FText::GetEmpty()), _OnClicked() {}
|
|
309
|
+
SLATE_ATTRIBUTE(FText, LabelText)
|
|
310
|
+
SLATE_EVENT(FSimpleDelegate, OnClicked)
|
|
311
|
+
SLATE_END_ARGS()
|
|
312
|
+
|
|
313
|
+
void Construct(const FArguments& InArgs);
|
|
314
|
+
private:
|
|
315
|
+
TAttribute<FText> LabelText;
|
|
316
|
+
FSimpleDelegate OnClicked;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// SMyWidget.cpp
|
|
320
|
+
void SMyWidget::Construct(const FArguments& InArgs)
|
|
321
|
+
{
|
|
322
|
+
LabelText = InArgs._LabelText;
|
|
323
|
+
OnClicked = InArgs._OnClicked;
|
|
324
|
+
ChildSlot
|
|
325
|
+
[
|
|
326
|
+
SNew(SButton)
|
|
327
|
+
.OnClicked_Lambda([this]() -> FReply { OnClicked.ExecuteIfBound(); return FReply::Handled(); })
|
|
328
|
+
[ SNew(STextBlock).Text(LabelText) ]
|
|
329
|
+
];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Instantiation
|
|
333
|
+
TSharedRef<SMyWidget> W = SNew(SMyWidget).LabelText(NSLOCTEXT("UI", "Btn", "Go"));
|
|
334
|
+
TSharedPtr<SButton> Btn;
|
|
335
|
+
SAssignNew(Btn, SButton).OnClicked(FOnClicked::CreateUObject(this, &UMyClass::Handle));
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
**Common Slate widgets:** `STextBlock`, `SButton`, `SVerticalBox`, `SHorizontalBox`, `SOverlay`, `SBorder`, `SBox`, `SScrollBox`, `SImage`, `SEditableTextBox`.
|
|
339
|
+
|
|
340
|
+
**Slate vs UMG:** Use Slate for editor tools and maximum control. Use UMG for game runtime UI, Blueprint extensibility, animations, and BindWidget.
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## 7. MVVM (UE 5.1+, ModelViewViewModel plugin)
|
|
345
|
+
|
|
346
|
+
```cpp
|
|
347
|
+
// ViewModel — MyGameViewModel.h
|
|
348
|
+
UCLASS()
|
|
349
|
+
class MYGAME_API UMyGameViewModel : public UMVVMViewModelBase
|
|
350
|
+
{
|
|
351
|
+
GENERATED_BODY()
|
|
352
|
+
public:
|
|
353
|
+
// UE_MVVM_SET_PROPERTY_VALUE: checks equality, sets, broadcasts field change
|
|
354
|
+
void SetScore(int32 NewScore) { UE_MVVM_SET_PROPERTY_VALUE(Score, NewScore); }
|
|
355
|
+
void SetPlayerName(FText NewName) { UE_MVVM_SET_PROPERTY_VALUE(PlayerName, NewName); }
|
|
356
|
+
int32 GetScore() const { return Score; }
|
|
357
|
+
FText GetPlayerName() const { return PlayerName; }
|
|
358
|
+
private:
|
|
359
|
+
UPROPERTY(BlueprintReadOnly, FieldNotify, Getter, meta=(AllowPrivateAccess))
|
|
360
|
+
int32 Score = 0;
|
|
361
|
+
UPROPERTY(BlueprintReadOnly, FieldNotify, Getter, meta=(AllowPrivateAccess))
|
|
362
|
+
FText PlayerName;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
// From game code — UI updates automatically via field notifications:
|
|
366
|
+
void AMyPlayerState::OnScoreChanged(int32 NewScore) { ViewModel->SetScore(NewScore); }
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
To bind a ViewModel at runtime: create with `NewObject<UMyGameViewModel>(this)`, then configure in the widget Blueprint's Bindings panel. The `UMVVMView` component on the widget handles one-way and two-way property bindings automatically once the ViewModel class is set.
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Common Mistakes
|
|
374
|
+
|
|
375
|
+
| Anti-pattern | Correct approach |
|
|
376
|
+
|---|---|
|
|
377
|
+
| `SetVisibility(Hidden)` to "hide" a menu | `RemoveFromParent()` to stop rendering and input |
|
|
378
|
+
| `CreateWidget(GetWorld(), ...)` for HUD widgets | `CreateWidget(GetOwningPlayer(), ...)` |
|
|
379
|
+
| `SetInputMode(FInputModeUIOnly())` for a HUD | Use `FInputModeGameAndUI` or Common UI's `GetDesiredInputConfig` |
|
|
380
|
+
| `AddDynamic` with `UCommonButtonBase::OnClicked()` | `AddUObject` — it's `FCommonButtonEvent` not DYNAMIC |
|
|
381
|
+
| Binding delegates in `NativeTick` | Bind once in `NativeConstruct`, unbind in `NativeDestruct` |
|
|
382
|
+
| Skipping `Super::NativeOnActivated/Deactivated` | Always call Super — it routes focus and input |
|
|
383
|
+
| One widget for all players in split-screen | `AddToPlayerScreen` with per-player widgets |
|
|
384
|
+
| No UPROPERTY reference after `RemoveFromParent` (widget leak) | Hold a `UPROPERTY() TObjectPtr<>` to prevent GC, or call `RemoveFromParent()` to allow GC when no longer needed |
|
|
385
|
+
| Z-order conflicts | Multiple widgets at same Z-order causes undefined draw order | Use explicit Z-order in `AddToViewport(ZOrder)` — higher values draw on top. Reserve ranges: HUD 0-9, menus 10-19, popups 20+ |
|
|
386
|
+
| Invisible widgets still tick | Hidden widgets with `NativeTick` consume CPU | Set `SetVisibility(ESlateVisibility::Collapsed)` (removes from layout) or call `RemoveFromParent()` for unused widgets. Override `NativeTick` with an early-out: `if (!IsVisible()) return;` |
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## Build.cs
|
|
391
|
+
|
|
392
|
+
```csharp
|
|
393
|
+
PublicDependencyModuleNames.AddRange(new string[] { "UMG", "Slate", "SlateCore" });
|
|
394
|
+
PrivateDependencyModuleNames.Add("CommonUI"); // If using CommonUI
|
|
395
|
+
PrivateDependencyModuleNames.Add("CommonInput"); // If using CommonInput
|
|
396
|
+
PrivateDependencyModuleNames.Add("ModelViewViewModel"); // If using MVVM
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## Related Skills
|
|
402
|
+
|
|
403
|
+
- `/ue-cpp-foundations` — UPROPERTY meta specifiers, TObjectPtr, module setup
|
|
404
|
+
- `/ue-input-system` — Enhanced Input, FInputModeXxx, input contexts
|
|
405
|
+
- `/ue-editor-tools` — Slate for editor detail panels and custom tools
|
|
406
|
+
- `/ue-naming-conventions` — asset prefixes and Content folder layout for these assets
|
|
407
|
+
|
|
408
|
+
## Reference Files
|
|
409
|
+
|
|
410
|
+
- `references/widget-types.md` — UMG widget type catalogue with the panel/layout decision guide
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Checklist
|
|
415
|
+
|
|
416
|
+
Validate before considering the work done:
|
|
417
|
+
|
|
418
|
+
- [ ] Widgets are data-bound or event-driven, not polling gameplay state every tick
|
|
419
|
+
- [ ] Focus, navigation and gamepad input were verified, not just mouse
|
|
420
|
+
- [ ] Widgets are pooled or properly removed rather than accumulating
|
|
421
|
+
- [ ] Conventions in `docs/unreal/project-context.md` were read and followed
|
|
422
|
+
- [ ] The Common Mistakes section of this skill was reviewed against the change
|
|
423
|
+
|
|
424
|
+
**PASS** — every item holds. **CONCERNS** — the work stands but at least one item is unresolved and worth flagging to the user. **FAIL** — an item is violated in a way that breaks correctness, replication or the frame budget; fix it before handing the work over.
|
|
425
|
+
|
|
426
|
+
## Next Steps
|
|
427
|
+
|
|
428
|
+
- `/accessibility` — check contrast, scaling and navigation
|
|
429
|
+
- `/perf-profile` — check widget tick and paint cost
|
|
430
|
+
- `/code-review` — architectural and quality review of the change
|
|
431
|
+
- `/commit` — conventional commit once the change is verified
|