claude-code-arcane 2.3.0 → 2.5.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.
Files changed (141) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +131 -41
  3. package/agents/game/ue-blueprint-specialist.md +125 -0
  4. package/agents/game/ue-gas-specialist.md +133 -0
  5. package/agents/game/ue-umg-specialist.md +131 -0
  6. package/dist/cli.js +642 -478
  7. package/docs/SKILLS-CATALOG.md +42 -3
  8. package/docs/USER-GUIDE.md +28 -54
  9. package/hooks/detect-unreal.sh +90 -0
  10. package/package.json +2 -1
  11. package/profiles/agile.yaml +1 -1
  12. package/profiles/ai.yaml +1 -1
  13. package/profiles/android-native.yaml +1 -1
  14. package/profiles/audio.yaml +1 -1
  15. package/profiles/backend-dotnet.yaml +1 -1
  16. package/profiles/backend-go.yaml +1 -1
  17. package/profiles/backend-nestjs.yaml +1 -1
  18. package/profiles/backend-nextjs.yaml +1 -1
  19. package/profiles/backend-ts.yaml +1 -1
  20. package/profiles/business.yaml +1 -1
  21. package/profiles/clevel.yaml +1 -1
  22. package/profiles/clickup.yaml +1 -1
  23. package/profiles/core.yaml +1 -1
  24. package/profiles/database.yaml +1 -1
  25. package/profiles/design.yaml +1 -1
  26. package/profiles/docs.yaml +1 -1
  27. package/profiles/ecommerce.yaml +1 -1
  28. package/profiles/finance.yaml +1 -1
  29. package/profiles/flutter.yaml +1 -1
  30. package/profiles/freelance.yaml +1 -1
  31. package/profiles/frontend.yaml +1 -1
  32. package/profiles/infra.yaml +1 -1
  33. package/profiles/integrations.yaml +1 -1
  34. package/profiles/ios-native.yaml +1 -1
  35. package/profiles/jira.yaml +1 -1
  36. package/profiles/job-hunt.yaml +1 -1
  37. package/profiles/marketing.yaml +1 -1
  38. package/profiles/mobile.yaml +1 -1
  39. package/profiles/regulatory.yaml +1 -1
  40. package/profiles/second-brain.yaml +1 -1
  41. package/profiles/security.yaml +1 -1
  42. package/profiles/self-improving.yaml +1 -1
  43. package/profiles/statusline.yaml +1 -1
  44. package/profiles/testing.yaml +1 -1
  45. package/profiles/unity-design.yaml +1 -1
  46. package/profiles/unity-dev.yaml +1 -1
  47. package/profiles/unreal-dev.yaml +97 -0
  48. package/profiles/visual-novel.yaml +1 -1
  49. package/rules/gamedev/unreal-code.md +125 -0
  50. package/skills/arcane-list/SKILL.md +12 -7
  51. package/skills/install-mcp/SKILL.md +135 -46
  52. package/skills/install-mcp/references/unreal-operations.md +55 -0
  53. package/skills/ue-actor-component-architecture/SKILL.md +509 -0
  54. package/skills/ue-actor-component-architecture/references/actor-lifecycle.md +301 -0
  55. package/skills/ue-actor-component-architecture/references/component-types.md +592 -0
  56. package/skills/ue-ai-navigation/SKILL.md +526 -0
  57. package/skills/ue-ai-navigation/references/behavior-tree-patterns.md +392 -0
  58. package/skills/ue-ai-navigation/references/behavior-tree-workflow.md +107 -0
  59. package/skills/ue-ai-navigation/references/custom-bttask.md +104 -0
  60. package/skills/ue-ai-navigation/references/eqs-reference.md +423 -0
  61. package/skills/ue-animation-system/SKILL.md +521 -0
  62. package/skills/ue-animation-system/references/anim-notify-reference.md +486 -0
  63. package/skills/ue-animation-system/references/locomotion-setup.md +550 -0
  64. package/skills/ue-async-threading/SKILL.md +433 -0
  65. package/skills/ue-async-threading/references/thread-safety-guide.md +213 -0
  66. package/skills/ue-async-threading/references/threading-patterns.md +345 -0
  67. package/skills/ue-audio-system/SKILL.md +527 -0
  68. package/skills/ue-audio-system/references/audio-setup-patterns.md +700 -0
  69. package/skills/ue-blueprints/SKILL.md +134 -0
  70. package/skills/ue-blueprints/references/communication.md +82 -0
  71. package/skills/ue-character-movement/SKILL.md +475 -0
  72. package/skills/ue-character-movement/references/cmc-extension-patterns.md +335 -0
  73. package/skills/ue-character-movement/references/movement-pipeline.md +189 -0
  74. package/skills/ue-cpp-foundations/SKILL.md +533 -0
  75. package/skills/ue-cpp-foundations/references/components-and-gc.md +107 -0
  76. package/skills/ue-cpp-foundations/references/container-patterns.md +544 -0
  77. package/skills/ue-cpp-foundations/references/delegate-patterns.md +497 -0
  78. package/skills/ue-cpp-foundations/references/gameplay-classes-cpp.md +136 -0
  79. package/skills/ue-cpp-foundations/references/property-specifiers.md +306 -0
  80. package/skills/ue-data-assets-tables/SKILL.md +527 -0
  81. package/skills/ue-data-assets-tables/references/asset-loading-patterns.md +306 -0
  82. package/skills/ue-data-assets-tables/references/data-driven-design.md +378 -0
  83. package/skills/ue-editor-tools/SKILL.md +523 -0
  84. package/skills/ue-editor-tools/references/detail-customization-patterns.md +395 -0
  85. package/skills/ue-editor-tools/references/editor-module-setup.md +480 -0
  86. package/skills/ue-game-features/SKILL.md +477 -0
  87. package/skills/ue-game-features/references/experience-system.md +222 -0
  88. package/skills/ue-game-features/references/game-feature-patterns.md +308 -0
  89. package/skills/ue-gameplay-abilities/SKILL.md +518 -0
  90. package/skills/ue-gameplay-abilities/references/ability-task-reference.md +391 -0
  91. package/skills/ue-gameplay-abilities/references/gameplay-effect-reference.md +397 -0
  92. package/skills/ue-gameplay-abilities/references/gas-setup-patterns.md +369 -0
  93. package/skills/ue-gameplay-framework/SKILL.md +466 -0
  94. package/skills/ue-gameplay-framework/references/framework-class-map.md +243 -0
  95. package/skills/ue-input-system/SKILL.md +394 -0
  96. package/skills/ue-input-system/references/cpp-setup.md +131 -0
  97. package/skills/ue-input-system/references/enhanced-input-workflow.md +117 -0
  98. package/skills/ue-input-system/references/input-action-reference.md +731 -0
  99. package/skills/ue-mass-entity/SKILL.md +476 -0
  100. package/skills/ue-mass-entity/references/mass-entity-patterns.md +319 -0
  101. package/skills/ue-mass-entity/references/mass-fragment-reference.md +119 -0
  102. package/skills/ue-materials-rendering/SKILL.md +526 -0
  103. package/skills/ue-materials-rendering/references/material-parameter-reference.md +216 -0
  104. package/skills/ue-materials-rendering/references/post-process-settings.md +383 -0
  105. package/skills/ue-module-build-system/SKILL.md +487 -0
  106. package/skills/ue-module-build-system/references/build-cs-reference.md +418 -0
  107. package/skills/ue-module-build-system/references/common-build-errors.md +381 -0
  108. package/skills/ue-naming-conventions/SKILL.md +142 -0
  109. package/skills/ue-naming-conventions/references/asset-name-modifiers.md +233 -0
  110. package/skills/ue-naming-conventions/references/content-structure.md +83 -0
  111. package/skills/ue-networking-replication/SKILL.md +452 -0
  112. package/skills/ue-networking-replication/references/replication-patterns.md +526 -0
  113. package/skills/ue-networking-replication/references/rpc-decision-guide.md +393 -0
  114. package/skills/ue-niagara-effects/SKILL.md +531 -0
  115. package/skills/ue-niagara-effects/references/niagara-data-interfaces.md +491 -0
  116. package/skills/ue-niagara-effects/references/niagara-parameter-types.md +153 -0
  117. package/skills/ue-niagara-effects/references/niagara-workflow.md +115 -0
  118. package/skills/ue-packaging/SKILL.md +116 -0
  119. package/skills/ue-physics-collision/SKILL.md +423 -0
  120. package/skills/ue-physics-collision/references/collision-channel-setup.md +218 -0
  121. package/skills/ue-physics-collision/references/trace-patterns.md +499 -0
  122. package/skills/ue-procedural-generation/SKILL.md +505 -0
  123. package/skills/ue-procedural-generation/references/pcg-node-reference.md +381 -0
  124. package/skills/ue-procedural-generation/references/procedural-mesh-patterns.md +940 -0
  125. package/skills/ue-project-context/SKILL.md +305 -0
  126. package/skills/ue-sequencer-cinematics/SKILL.md +506 -0
  127. package/skills/ue-sequencer-cinematics/references/sequencer-patterns.md +629 -0
  128. package/skills/ue-serialization-savegames/SKILL.md +524 -0
  129. package/skills/ue-serialization-savegames/references/save-system-architecture.md +705 -0
  130. package/skills/ue-state-trees/SKILL.md +489 -0
  131. package/skills/ue-state-trees/references/state-tree-mass-integration.md +184 -0
  132. package/skills/ue-state-trees/references/state-tree-patterns.md +321 -0
  133. package/skills/ue-testing-debugging/SKILL.md +520 -0
  134. package/skills/ue-testing-debugging/references/automation-test-patterns.md +387 -0
  135. package/skills/ue-testing-debugging/references/profiling-commands.md +357 -0
  136. package/skills/ue-ui-umg-slate/SKILL.md +431 -0
  137. package/skills/ue-ui-umg-slate/references/common-ui-setup.md +484 -0
  138. package/skills/ue-ui-umg-slate/references/widget-types.md +487 -0
  139. package/skills/ue-world-level-streaming/SKILL.md +518 -0
  140. package/skills/ue-world-level-streaming/references/streaming-patterns.md +414 -0
  141. package/templates/gamedev/unreal-project-context.md +107 -0
@@ -0,0 +1,592 @@
1
+ # Component Types Reference
2
+
3
+ Complete reference for UE's built-in component types with inheritance hierarchy, capabilities, use cases, and creation patterns. All component classes live under `Engine/Source/Runtime/Engine/Classes/Components/` unless otherwise noted.
4
+
5
+ ---
6
+
7
+ ## Inheritance Hierarchy
8
+
9
+ ```
10
+ UObject
11
+ └── UActorComponent Logic-only; no transform
12
+ └── USceneComponent Adds transform + attachment
13
+ └── UPrimitiveComponent Adds collision + rendering + physics
14
+ ├── UMeshComponent
15
+ │ ├── UStaticMeshComponent
16
+ │ ├── USkeletalMeshComponent
17
+ │ ├── UInstancedStaticMeshComponent
18
+ │ └── UProceduralMeshComponent
19
+ ├── UShapeComponent
20
+ │ ├── UCapsuleComponent
21
+ │ ├── UBoxComponent
22
+ │ └── USphereComponent
23
+ └── ULightComponentBase
24
+ ├── UPointLightComponent
25
+ ├── USpotLightComponent
26
+ └── UDirectionalLightComponent
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Layer 1: UActorComponent
32
+
33
+ **Header**: `Components/ActorComponent.h`
34
+
35
+ **What it is**: The base class for all components. Has no transform, no position in the world. Pure behavior and data.
36
+
37
+ **Key properties from source**:
38
+ ```cpp
39
+ // Tick function — must set bCanEverTick = true to use
40
+ struct FActorComponentTickFunction PrimaryComponentTick;
41
+
42
+ // Whether the component activates itself during initialization
43
+ uint8 bAutoActivate : 1;
44
+
45
+ // Whether InitializeComponent() is called during startup
46
+ uint8 bWantsInitializeComponent : 1;
47
+
48
+ // Component can replicate — owner actor must also replicate
49
+ uint8 bReplicates : 1;
50
+
51
+ // Tags for grouping, accessible from Blueprint
52
+ TArray<FName> ComponentTags;
53
+ ```
54
+
55
+ **Key virtual functions to override**:
56
+ ```cpp
57
+ virtual void InitializeComponent(); // One-time setup; requires bWantsInitializeComponent=true
58
+ virtual void BeginPlay(); // Game starts
59
+ virtual void EndPlay(EEndPlayReason); // Cleanup
60
+ virtual void TickComponent(float DeltaTime, ELevelTick, FActorComponentTickFunction*);
61
+ virtual void Activate(bool bReset); // Custom activation logic
62
+ virtual void Deactivate();
63
+ virtual bool ShouldActivate() const; // Return false to block activation
64
+ virtual void OnRegister(); // Component registered with world
65
+ virtual void OnUnregister(); // Component unregistered
66
+ ```
67
+
68
+ **When to use**:
69
+ - Health/stamina/mana tracking
70
+ - Inventory and item management
71
+ - Status effect systems
72
+ - Buff/debuff application
73
+ - AI blackboard bridging
74
+ - Ability management (alternative to GAS for simple cases)
75
+ - Save game data aggregation per actor
76
+
77
+ **Creation pattern**:
78
+ ```cpp
79
+ // Constructor
80
+ HealthComponent = CreateDefaultSubobject<UHealthComponent>(TEXT("Health"));
81
+
82
+ // Runtime
83
+ UHealthComponent* HC = NewObject<UHealthComponent>(this, UHealthComponent::StaticClass());
84
+ HC->RegisterComponent();
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Layer 2: USceneComponent
90
+
91
+ **Header**: `Components/SceneComponent.h`
92
+
93
+ **What it is**: A `UActorComponent` that has a `FTransform` (`RelativeLocation`, `RelativeRotation`, `RelativeScale3D`). Can attach to and from other `USceneComponent`s, building a hierarchical transform tree.
94
+
95
+ **Key properties from source**:
96
+ ```cpp
97
+ // Transform (private — use accessors)
98
+ FVector RelativeLocation;
99
+ FRotator RelativeRotation;
100
+ FVector RelativeScale3D;
101
+
102
+ // Attachment parent
103
+ TObjectPtr<USceneComponent> AttachParent;
104
+ FName AttachSocketName;
105
+
106
+ // Children
107
+ TArray<TObjectPtr<USceneComponent>> AttachChildren;
108
+
109
+ // Mobility — only safe to set in constructor
110
+ TEnumAsByte<EComponentMobility::Type> Mobility;
111
+ // EComponentMobility::Static — baked lighting, no runtime movement
112
+ // EComponentMobility::Stationary — baked shadows, can change intensity/color
113
+ // EComponentMobility::Movable — fully dynamic, moves at runtime
114
+
115
+ // Visibility
116
+ uint8 bVisible : 1;
117
+ uint8 bHiddenInGame : 1;
118
+
119
+ // Absolute flags (ignore parent transform for that axis)
120
+ uint8 bAbsoluteLocation : 1;
121
+ uint8 bAbsoluteRotation : 1;
122
+ uint8 bAbsoluteScale : 1;
123
+ ```
124
+
125
+ **Key transform API**:
126
+ ```cpp
127
+ // Position
128
+ void SetRelativeLocation(FVector);
129
+ void SetWorldLocation(FVector);
130
+ FVector GetRelativeLocation() const;
131
+ FVector GetComponentLocation() const; // World space
132
+
133
+ // Rotation
134
+ void SetRelativeRotation(FRotator);
135
+ void SetWorldRotation(FRotator);
136
+ FRotator GetRelativeRotation() const;
137
+ FRotator GetComponentRotation() const; // World space
138
+
139
+ // Full transform
140
+ void SetRelativeTransform(const FTransform&);
141
+ void SetWorldTransform(const FTransform&);
142
+ FTransform GetRelativeTransform() const;
143
+ FTransform GetComponentTransform() const; // = ComponentToWorld
144
+
145
+ // Movement with sweep (collision-aware)
146
+ bool MoveComponent(const FVector& Delta, const FQuat& NewRotation, bool bSweep,
147
+ FHitResult* Hit, EMoveComponentFlags Flags, ETeleportType Teleport);
148
+ ```
149
+
150
+ **Attachment API**:
151
+ ```cpp
152
+ // Constructor-time parent declaration (no world required)
153
+ Child->SetupAttachment(Parent);
154
+ Child->SetupAttachment(Parent, SocketName);
155
+
156
+ // Runtime attachment with transform rules
157
+ Child->AttachToComponent(Parent, FAttachmentTransformRules::KeepRelativeTransform);
158
+ Child->AttachToComponent(Parent, FAttachmentTransformRules::KeepWorldTransform);
159
+ Child->AttachToComponent(Parent, FAttachmentTransformRules::SnapToTargetNotIncludingScale, SocketName);
160
+
161
+ // Detach
162
+ Child->DetachFromComponent(FDetachmentTransformRules::KeepWorldTransform);
163
+ Child->DetachFromComponent(FDetachmentTransformRules::KeepRelativeTransform);
164
+ ```
165
+
166
+ **`FAttachmentTransformRules` options**:
167
+
168
+ | Rule | Location | Rotation | Scale | Typical use |
169
+ |---|---|---|---|---|
170
+ | `KeepRelativeTransform` | Relative | Relative | Relative | Default — preserves local offset |
171
+ | `KeepWorldTransform` | World | World | World | Actor already positioned correctly |
172
+ | `SnapToTargetIncludingScale` | Target | Target | Target | Hard snap to socket, match scale |
173
+ | `SnapToTargetNotIncludingScale` | Target | Target | Self | Hard snap to socket, own scale |
174
+
175
+ **When to use `USceneComponent` directly**:
176
+ - Pivot point / offset node: attach children to a scene component to shift their origin without a visible mesh
177
+ - Spawn location markers (invisible reference points)
178
+ - Grouping components that should move together under one transform
179
+
180
+ ```cpp
181
+ // Common pattern: scene component as a group pivot
182
+ GroupPivot = CreateDefaultSubobject<USceneComponent>(TEXT("GroupPivot"));
183
+ GroupPivot->SetupAttachment(RootComponent);
184
+
185
+ MeshA->SetupAttachment(GroupPivot);
186
+ MeshB->SetupAttachment(GroupPivot);
187
+ // Rotate GroupPivot to rotate both meshes together
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Layer 3: UPrimitiveComponent
193
+
194
+ **Header**: `Components/PrimitiveComponent.h`
195
+
196
+ **What it is**: Extends `USceneComponent` with:
197
+ - Collision geometry (collision response channels, query/physics collision)
198
+ - Render proxy (submitted to the renderer each frame)
199
+ - Physics simulation (rigid body, constraints)
200
+ - Overlap/hit events
201
+
202
+ **Key collision API**:
203
+ ```cpp
204
+ void SetCollisionEnabled(ECollisionEnabled::Type);
205
+ // ECollisionEnabled::NoCollision
206
+ // ECollisionEnabled::QueryOnly — overlaps and line traces, no physics
207
+ // ECollisionEnabled::PhysicsOnly — physics push/pull, no queries
208
+ // ECollisionEnabled::QueryAndPhysics
209
+
210
+ void SetCollisionObjectType(ECollisionChannel);
211
+ void SetCollisionResponseToChannel(ECollisionChannel, ECollisionResponse);
212
+ void SetCollisionResponseToAllChannels(ECollisionResponse);
213
+ void SetCollisionProfileName(FName ProfileName);
214
+
215
+ // Overlap events
216
+ void SetGenerateOverlapEvents(bool);
217
+ FComponentBeginOverlapSignature OnComponentBeginOverlap;
218
+ FComponentEndOverlapSignature OnComponentEndOverlap;
219
+
220
+ // Hit events (blocking collision)
221
+ FComponentHitSignature OnComponentHit;
222
+ ```
223
+
224
+ **Physics simulation**:
225
+ ```cpp
226
+ void SetSimulatePhysics(bool bSimulate);
227
+ void SetEnableGravity(bool bGravityEnabled);
228
+ void AddForce(FVector Force, FName BoneName = NAME_None, bool bAccelChange = false);
229
+ void AddImpulse(FVector Impulse, FName BoneName = NAME_None, bool bVelChange = false);
230
+ void SetPhysicsLinearVelocity(FVector NewVel, bool bAddToCurrent = false);
231
+ FVector GetPhysicsLinearVelocity(FName BoneName = NAME_None);
232
+ ```
233
+
234
+ ---
235
+
236
+ ## Mesh Components
237
+
238
+ ### UStaticMeshComponent
239
+
240
+ **Header**: `Components/StaticMeshComponent.h`
241
+
242
+ A rendered mesh with pre-baked lighting. The mesh geometry does not deform. The workhorse for environment art — buildings, props, weapons, projectiles.
243
+
244
+ ```cpp
245
+ UStaticMeshComponent* Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
246
+ SetRootComponent(Mesh);
247
+
248
+ // Set mesh from C++ (usually set via Blueprint or Details panel)
249
+ static ConstructorHelpers::FObjectFinder<UStaticMesh> MeshAsset(
250
+ TEXT("/Game/Meshes/MyMesh"));
251
+ if (MeshAsset.Succeeded())
252
+ {
253
+ Mesh->SetStaticMesh(MeshAsset.Object);
254
+ }
255
+
256
+ // Runtime mesh swap
257
+ Mesh->SetStaticMesh(NewMeshAsset);
258
+
259
+ // Material override
260
+ Mesh->SetMaterial(0, MaterialInstance);
261
+
262
+ // Mobility — set in constructor for performance
263
+ Mesh->SetMobility(EComponentMobility::Movable);
264
+ ```
265
+
266
+ ### USkeletalMeshComponent
267
+
268
+ **Header**: `Components/SkeletalMeshComponent.h`
269
+
270
+ A mesh with a skeleton (bone hierarchy) that drives deformation. Required for characters, creatures, and anything that needs animation. Supports AnimBP, montages, sockets, morph targets.
271
+
272
+ ```cpp
273
+ USkeletalMeshComponent* CharMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharMesh"));
274
+ CharMesh->SetupAttachment(RootComponent);
275
+
276
+ // Play animation montage
277
+ CharMesh->GetAnimInstance()->Montage_Play(AttackMontage);
278
+
279
+ // Get socket transform (for attaching weapons, spawning VFX)
280
+ FTransform SocketTransform = CharMesh->GetSocketTransform(TEXT("WeaponSocket"));
281
+
282
+ // Bone manipulation at runtime — SetBoneLocationByName is on UPoseableMeshComponent,
283
+ // not USkeletalMeshComponent. For driven bone transforms, use UPoseableMeshComponent:
284
+ // PoseableMesh->SetBoneLocationByName(TEXT("spine_01"), NewLocation, EBoneSpaces::WorldSpace);
285
+ ```
286
+
287
+ ### UInstancedStaticMeshComponent (ISMC)
288
+
289
+ **Header**: `Components/InstancedStaticMeshComponent.h`
290
+
291
+ Renders many instances of the same static mesh in a single draw call using GPU instancing. Essential for foliage, crowds, spawned duplicates (e.g. bullet casings on the ground).
292
+
293
+ ```cpp
294
+ UInstancedStaticMeshComponent* ISMC = CreateDefaultSubobject<UInstancedStaticMeshComponent>(TEXT("ISMC"));
295
+ ISMC->SetStaticMesh(TreeMesh);
296
+
297
+ // Add instances
298
+ for (int32 i = 0; i < 1000; i++)
299
+ {
300
+ FTransform InstanceTransform = GetRandomTransform();
301
+ ISMC->AddInstance(InstanceTransform);
302
+ }
303
+
304
+ // Update a specific instance
305
+ ISMC->UpdateInstanceTransform(InstanceIndex, NewTransform, /*bWorldSpace=*/true);
306
+
307
+ // Remove instance
308
+ ISMC->RemoveInstance(InstanceIndex);
309
+ ```
310
+
311
+ ---
312
+
313
+ ## Shape / Collision Components
314
+
315
+ These are invisible collision volumes used for overlap detection, trigger zones, and character collision. They have no visual representation in-game.
316
+
317
+ ### UCapsuleComponent
318
+
319
+ **Header**: `Components/CapsuleComponent.h`
320
+
321
+ The standard root component for `ACharacter`. The vertical capsule shape is ideal for characters because it slides over small bumps and provides stable physics interaction.
322
+
323
+ ```cpp
324
+ // ACharacter already creates this as its root — you rarely create it manually
325
+ // Access via ACharacter::GetCapsuleComponent()
326
+
327
+ UCapsuleComponent* Capsule = CreateDefaultSubobject<UCapsuleComponent>(TEXT("Capsule"));
328
+ SetRootComponent(Capsule);
329
+ Capsule->InitCapsuleSize(42.f, 96.f); // Radius, HalfHeight
330
+
331
+ // Collision profile
332
+ Capsule->SetCollisionProfileName(TEXT("Pawn"));
333
+ ```
334
+
335
+ ### UBoxComponent
336
+
337
+ **Header**: `Components/BoxComponent.h`
338
+
339
+ An axis-aligned box. Common for trigger zones, room boundaries, button hitboxes, and rectangular objects.
340
+
341
+ ```cpp
342
+ UBoxComponent* TriggerBox = CreateDefaultSubobject<UBoxComponent>(TEXT("TriggerZone"));
343
+ TriggerBox->SetupAttachment(RootComponent);
344
+ TriggerBox->SetBoxExtent(FVector(200.f, 200.f, 100.f)); // Half extents
345
+ TriggerBox->SetCollisionProfileName(TEXT("Trigger"));
346
+ TriggerBox->OnComponentBeginOverlap.AddDynamic(this, &AMyActor::OnOverlapBegin);
347
+ ```
348
+
349
+ ### USphereComponent
350
+
351
+ **Header**: `Components/SphereComponent.h`
352
+
353
+ A sphere. Common for explosion radius checks, audio area triggers, and simple interactable zones.
354
+
355
+ ```cpp
356
+ USphereComponent* DetectionRadius = CreateDefaultSubobject<USphereComponent>(TEXT("Detection"));
357
+ DetectionRadius->SetupAttachment(RootComponent);
358
+ DetectionRadius->SetSphereRadius(500.f);
359
+ DetectionRadius->SetCollisionProfileName(TEXT("Trigger"));
360
+ ```
361
+
362
+ ---
363
+
364
+ ## Camera and View Components
365
+
366
+ ### USpringArmComponent
367
+
368
+ **Header**: `GameFramework/SpringArmComponent.h`
369
+
370
+ Implements a "boom" arm with collision-aware retraction. Positions the camera behind a character with automatic obstruction avoidance. The standard third-person camera rig.
371
+
372
+ ```cpp
373
+ SpringArmComp = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArm"));
374
+ SpringArmComp->SetupAttachment(RootComponent);
375
+ SpringArmComp->TargetArmLength = 400.f; // Boom length in cm
376
+ SpringArmComp->bUsePawnControlRotation = true; // Rotate with controller yaw
377
+ SpringArmComp->bEnableCameraLag = true; // Smooth follow
378
+ SpringArmComp->CameraLagSpeed = 8.f;
379
+
380
+ // Socket name for camera attachment
381
+ // SpringArmComp has a built-in socket: USpringArmComponent::SocketName
382
+ ```
383
+
384
+ ### UCameraComponent
385
+
386
+ **Header**: `Camera/CameraComponent.h`
387
+
388
+ Defines a camera view. When the owning actor is the ViewTarget, this component supplies the `FMinimalViewInfo` used for rendering.
389
+
390
+ ```cpp
391
+ CameraComp = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
392
+ CameraComp->SetupAttachment(SpringArmComp, USpringArmComponent::SocketName);
393
+ CameraComp->bUsePawnControlRotation = false; // Spring arm handles it
394
+
395
+ // Field of view
396
+ CameraComp->FieldOfView = 90.f;
397
+
398
+ // Cinematic settings
399
+ CameraComp->PostProcessSettings.bOverride_DepthOfFieldFstop = true;
400
+ CameraComp->PostProcessSettings.DepthOfFieldFstop = 1.4f;
401
+ ```
402
+
403
+ ---
404
+
405
+ ## Special Components
406
+
407
+ ### UArrowComponent
408
+
409
+ **Header**: `Components/ArrowComponent.h`
410
+
411
+ Editor-only visualization arrow. Marks spawn points, projectile directions, patrol waypoints, and any directional reference that needs to be visible in the editor viewport but not in-game.
412
+
413
+ ```cpp
414
+ ArrowComp = CreateDefaultSubobject<UArrowComponent>(TEXT("Arrow"));
415
+ ArrowComp->SetupAttachment(RootComponent);
416
+ ArrowComp->ArrowColor = FColor::Yellow;
417
+ ArrowComp->ArrowSize = 2.f;
418
+ ArrowComp->bHiddenInGame = true; // Not visible during play — editor only
419
+ ```
420
+
421
+ ### UChildActorComponent
422
+
423
+ **Header**: `Components/ChildActorComponent.h`
424
+
425
+ Embeds another actor inside this actor's component tree. The child actor lives at the component's world transform and moves with it. Useful for modular actors (building blocks, vehicle parts) and Blueprint actor graphs.
426
+
427
+ ```cpp
428
+ UChildActorComponent* ChildActorComp = CreateDefaultSubobject<UChildActorComponent>(TEXT("ChildActor"));
429
+ ChildActorComp->SetupAttachment(RootComponent);
430
+ ChildActorComp->SetChildActorClass(AMyChildActor::StaticClass());
431
+
432
+ // Access the child actor at runtime (after BeginPlay)
433
+ AMyChildActor* Child = Cast<AMyChildActor>(ChildActorComp->GetChildActor());
434
+ ```
435
+
436
+ **Warning**: Child actor BeginPlay is called after the parent's `PostInitializeComponents` but the exact timing relative to the parent's `BeginPlay` depends on whether the parent was spawned or level-placed. Always access child actors in or after `BeginPlay`, never in `PostInitializeComponents`.
437
+
438
+ ### UWidgetComponent
439
+
440
+ **Header**: `Components/WidgetComponent.h` (UMG module)
441
+
442
+ Renders a `UUserWidget` as a 3D object in the world. Used for 3D UI on characters (health bars over enemies), interactive surfaces, and world-space HUDs.
443
+
444
+ ```cpp
445
+ // Module dependency: add "UMG" to PublicDependencyModuleNames in .Build.cs
446
+
447
+ UWidgetComponent* HealthBarWidget = CreateDefaultSubobject<UWidgetComponent>(TEXT("HealthBar"));
448
+ HealthBarWidget->SetupAttachment(RootComponent);
449
+ HealthBarWidget->SetWidgetClass(UHealthBarWidget::StaticClass());
450
+ HealthBarWidget->SetDrawSize(FVector2D(200.f, 50.f));
451
+ HealthBarWidget->SetDrawAtDesiredSize(false);
452
+
453
+ // At runtime — get the widget instance and cast to your widget class
454
+ UHealthBarWidget* Widget = Cast<UHealthBarWidget>(HealthBarWidget->GetWidget());
455
+ if (Widget)
456
+ {
457
+ Widget->SetHealthPercent(0.75f);
458
+ }
459
+ ```
460
+
461
+ ---
462
+
463
+ ## Audio and Effects Components
464
+
465
+ ### UAudioComponent
466
+
467
+ **Header**: `Components/AudioComponent.h`
468
+
469
+ Plays a sound (USoundBase, USoundCue, USoundWave) at the component's world location with 3D spatialization.
470
+
471
+ ```cpp
472
+ UAudioComponent* AudioComp = CreateDefaultSubobject<UAudioComponent>(TEXT("Audio"));
473
+ AudioComp->SetupAttachment(RootComponent);
474
+ AudioComp->SetSound(IdleLoopSound);
475
+ AudioComp->bAutoActivate = false; // Don't play on spawn
476
+
477
+ // Runtime control
478
+ AudioComp->Play();
479
+ AudioComp->Stop();
480
+ AudioComp->FadeIn(2.0f); // 2-second fade in
481
+ AudioComp->FadeOut(1.0f, 0.f); // 1-second fade to silence then stop
482
+ AudioComp->SetVolumeMultiplier(0.5f);
483
+ AudioComp->SetPitchMultiplier(1.2f);
484
+ ```
485
+
486
+ ### UNiagaraComponent
487
+
488
+ **Header**: `NiagaraComponent.h` (Niagara module)
489
+
490
+ Instances a Niagara particle system at the component's location. Use for persistent effects (fire, smoke, shields) that live on the actor.
491
+
492
+ ```cpp
493
+ // Module dependency: add "Niagara" to PublicDependencyModuleNames
494
+
495
+ UNiagaraComponent* FireFX = CreateDefaultSubobject<UNiagaraComponent>(TEXT("FireEffect"));
496
+ FireFX->SetupAttachment(RootComponent);
497
+ FireFX->SetAsset(FireNiagaraSystem);
498
+ FireFX->bAutoActivate = false;
499
+
500
+ // Runtime
501
+ FireFX->Activate();
502
+ FireFX->Deactivate();
503
+ FireFX->SetVariableFloat(TEXT("EmitterRate"), 100.f);
504
+ FireFX->SetVariableLinearColor(TEXT("FlameColor"), FLinearColor::Red);
505
+ ```
506
+
507
+ ---
508
+
509
+ ## Physics and Simulation
510
+
511
+ ### UPhysicsConstraintComponent
512
+
513
+ **Header**: `PhysicsEngine/PhysicsConstraintComponent.h`
514
+
515
+ A joint constraint between two physics bodies or between a body and the world. Used for hinges (doors, flaps), ball sockets (ragdoll joints), prismatic sliders (elevators), and breakable constraints.
516
+
517
+ ```cpp
518
+ UPhysicsConstraintComponent* HingeConstraint = CreateDefaultSubobject<UPhysicsConstraintComponent>(TEXT("HingeConstraint"));
519
+ HingeConstraint->SetupAttachment(RootComponent);
520
+
521
+ // Constrain two bodies
522
+ HingeConstraint->SetConstrainedComponents(BodyA, NAME_None, BodyB, NAME_None);
523
+
524
+ // Configure as a hinge (rotation about X, locked Y/Z)
525
+ HingeConstraint->SetAngularSwing1Limit(ACM_Locked, 0.f);
526
+ HingeConstraint->SetAngularSwing2Limit(ACM_Locked, 0.f);
527
+ HingeConstraint->SetAngularTwistLimit(ACM_Free, 0.f);
528
+ ```
529
+
530
+ ---
531
+
532
+ ## Component Decision Guide
533
+
534
+ | Need | Component |
535
+ |---|---|
536
+ | Logic only, no position | `UActorComponent` |
537
+ | Position anchor, no visuals | `USceneComponent` |
538
+ | Static environment mesh | `UStaticMeshComponent` |
539
+ | Animated character/creature | `USkeletalMeshComponent` |
540
+ | Thousands of same mesh | `UInstancedStaticMeshComponent` |
541
+ | Character collision root | `UCapsuleComponent` |
542
+ | Trigger zone (rectangular) | `UBoxComponent` |
543
+ | Trigger zone (radial) | `USphereComponent` |
544
+ | Third-person camera | `USpringArmComponent` + `UCameraComponent` |
545
+ | World-space UI | `UWidgetComponent` |
546
+ | Persistent particle effect | `UNiagaraComponent` |
547
+ | Spatial audio | `UAudioComponent` |
548
+ | Nested actor | `UChildActorComponent` |
549
+ | Editor-only direction marker | `UArrowComponent` |
550
+ | Physics joint | `UPhysicsConstraintComponent` |
551
+
552
+ ---
553
+
554
+ ## Finding Components at Runtime
555
+
556
+ ```cpp
557
+ // Get a component by class — returns first match
558
+ UHealthComponent* Health = Actor->FindComponentByClass<UHealthComponent>();
559
+
560
+ // Get all components of a class
561
+ TArray<UStaticMeshComponent*> AllMeshes;
562
+ Actor->GetComponents<UStaticMeshComponent>(AllMeshes);
563
+
564
+ // Inline array variant (avoids heap allocation for small counts)
565
+ TInlineComponentArray<UPrimitiveComponent*> Primitives;
566
+ Actor->GetComponents(Primitives);
567
+
568
+ // By name
569
+ UActorComponent* Named = Actor->GetDefaultSubobjectByName(TEXT("HealthComponent"));
570
+
571
+ // Blueprint component query
572
+ Actor->FindComponentByInterface(UInteractable::StaticClass());
573
+ ```
574
+
575
+ ---
576
+
577
+ ## Component Mobility and Performance
578
+
579
+ `EComponentMobility` must be set in the constructor. It cannot be changed at runtime for static lighting to be valid.
580
+
581
+ ```cpp
582
+ // Static — fully baked lighting; cannot move at runtime
583
+ Mesh->SetMobility(EComponentMobility::Static);
584
+
585
+ // Stationary — baked shadows; can change color/intensity
586
+ Mesh->SetMobility(EComponentMobility::Stationary);
587
+
588
+ // Movable — dynamic lighting; can translate/rotate at runtime
589
+ Mesh->SetMobility(EComponentMobility::Movable);
590
+ ```
591
+
592
+ Performance implication: `Movable` components cast dynamic shadows (expensive). Use `Static` for anything that never moves. Use `Movable` only when the component actually needs to translate, rotate, or scale at runtime.