ue-ai-navigation
Use this skill when implementing AI, AIController, behavior tree, blackboard, AI perception,…
Use this skill when working with Actor and component design in Unreal Engine. Triggers on: Actor, component, BeginPlay, Tick, SpawnActor, lifecycle, CreateDefaultSubobject, composition, EndPlay, PostInitializeComponents, UActorComponent, USceneComponent, UINTERFACE, attachment,
$ npx -y skills add quodsoler/unreal-engine-skills --skill ue-actor-component-architecture --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/ue-actor-component-architectureContext preview
The summary Claude sees to decide when to auto-load this skill.
Use this skill when working with Actor and component design in Unreal Engine. Triggers on: Actor, component, BeginPlay, Tick, SpawnActor, lifecycle, CreateDefaultSubobject, composition, EndPlay, PostInitializeComponents, UActorComponent, USceneComponent, UINTERFACE, attachment,
name: ue-actor-component-architecture description: "Use this skill when working with Actor and component design in Unreal Engine. Triggers on: Actor, component, BeginPlay, Tick, SpawnActor, lifecycle, CreateDefaultSubobject, composition, EndPlay, PostInitializeComponents, UActorComponent, USceneComponent, UINTERFACE, attachment, spawn, interface. See references/actor-lifecycle.md and references/component-types.md for detailed tables." metadata: version: 1.0.0
You are an expert in Unreal Engine's Actor-Component architecture.
Before responding, read `.agents/ue-project-context.md` for the project's subsystem inventory, coding conventions, and any existing actor hierarchies or component patterns. This tells you which base classes are established and what naming conventions apply.
Clarify the developer's specific need before diving in:
---
Unreal's Actor-Component system is **composition over inheritance**. An `AActor` is a container that owns components. Behavior, rendering, collision, and logic are all expressed through `UActorComponent` subclasses.
UObject
└── AActor (placeable/spawnable world entity)
└── owns N x UActorComponent (reusable behavior units)
└── USceneComponent (adds transform + attachment)
└── UPrimitiveComponent (adds collision + rendering)`AActor` is a full `UObject` — never `new`/`delete` an actor. Always use `SpawnActor` and `Destroy`.
---
Full event order and safety rules are in `references/actor-lifecycle.md`. Key sequence:
Constructor → CreateDefaultSubobject, tick config, default values PostActorCreated → spawned actors only; before construction script PostInitializeComponents → all components initialized; world accessible BeginPlay → game running; full logic OK; components BeginPlay fires here Tick(DeltaTime) → per-frame; each ticking component's TickComponent fires EndPlay(EEndPlayReason) → cleanup; ClearAllTimers; call Super Destroyed → pre-GC; avoid complex logic
**Constructor** runs first on the **Class Default Object (CDO)** — an archetype used for default values. `GetWorld()` returns `nullptr` on the CDO. Never access the world or other actors in the constructor.
// CORRECT — constructor-time only
AMyActor::AMyActor()
{
MeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
SetRootComponent(MeshComp);
PrimaryActorTick.bCanEverTick = true;
PrimaryActorTick.TickInterval = 0.1f;
}
// CORRECT — world-dependent code belongs in BeginPlay
void AMyActor::BeginPlay()
{
Super::BeginPlay(); // Required — always call Super
GetWorld()->SpawnActor<AProjectile>(...);
}Called before BeginPlay; components are initialized; world exists. Use it to bind delegates to own components.
void AMyCharacter::PostInitializeComponents()
{
Super::PostInitializeComponents();
HealthComponent->OnDeath.AddDynamic(this, &AMyCharacter::HandleDeath);
}| Reason | When | |---|---| | `Destroyed` | `Actor->Destroy()` called explicitly | | `LevelTransition` | Map change | | `EndPlayInEditor` | PIE session ended | | `RemovedFromWorld` | Level streaming unloaded the sublevel | | `Quit` | Application shutdown |
void AMyActor::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
GetWorld()->GetTimerManager().ClearAllTimersForObject(this);
Super::EndPlay(EndPlayReason);
}**Replicated actors**: on clients, `BeginPlay` may fire before all replicated properties arrive. Use `OnRep_` callbacks for initialization that depends on replicated state. `PostNetReceive()` fires after each replication update (including the initial one); guard one-time setup inside it with a `bHasInitialized` flag. `PostNetInit` is not a standard `AActor` virtual and should not be used as a general init hook.
---
| Class | Transform | Rendering/Collision | Use for | |---|---|---|---| | `UActorComponent` | No | No | Pure logic — health, inventory, AI data | | `USceneComponent` | Yes | No | Transform anchors, grouping, pivot points | | `UPrimitiveComponent` | Yes | Yes | Meshes, shapes, anything visible or collidable |
**Notable subclasses**: `UStaticMeshComponent`, `USkeletalMeshComponent`, shape primitives (`UCapsuleComponent`, `UBoxComponent`, `USphereComponent`), `UWidgetComponent` (3D UI in world space — requires `"UMG"` module), `USpringArmComponent` + `UCameraComponent`, `UChildActorComponent`. See `references/component-types.md`.
**In the constructor** (for default components that appear in the Details panel):
AMyActor::AMyActor()
{
// CreateDefaultSubobject registers the component as a subobject —
// it is serialized with the actor and visible in Blueprint editors.
MeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
SetRootComponent(MeshComp);
ArrowComp = CreateDefaultSubobject<UArrowComponent>(TEXT("Arrow"));
ArrowComp->SetupAttachment(MeshComp); // Parent set here; no world needed
HealthComp = CreateDefaultSubobject<UHealthComponent>(TEXT("Health"));
// Logic-only components need no attachment
}**At runtime** (dynamic addition):
void AMyActor::AddLight()
{
// NewObject creates but does NOT register with the world
UPointLightA collection of 27 AI agent skills for Unreal Engine C++ development. Built for game developers who want AI coding agents to help write correct, production-quality UE5 C++ code.
Use this skill when implementing AI, AIController, behavior tree, blackboard, AI perception,…
Use this skill when working with Unreal Engine animation: AnimInstance, montage playback,…
Use this skill when working with Unreal Engine async operations, threading, parallel…
Use this skill when working with audio, sound, music, UAudioComponent, PlaySoundAtLocation,…
Use this skill when working with character movement, CharacterMovementComponent, CMC,…
Use when writing Unreal Engine C++ code involving UPROPERTY, UFUNCTION, UCLASS, TArray, TMap,…