77 game-dev skills for AI coding agents — Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox. Portable SKILL.md Agent Skills (the format Anthropic launched as Claude Skills), with a router that loads the right skill for your engine and task. Runs in Claude Code, Cursor, Kiro, Codex, Copilot, Gemini CLI and more.
Python agent-skillsai-agentsantigravityawesome-listclaude-codeclinecodexcursorgame-devgame-developmentgamedevgemini-cligithub-copilotgodotkirooh-my-piskillsunityunrealwindsurf
feat(unreal): add 6 Unreal Engine 5 skills
AbhishekBarali108676747664c
diff --git a/skills/unreal/unreal-behavior-trees/SKILL.md b/skills/unreal/unreal-behavior-trees/SKILL.mdnew file mode 100644index 0000000..71de62d--- /dev/null+++ b/skills/unreal/unreal-behavior-trees/SKILL.md@@ -0,0 +1,120 @@+---+name: unreal-behavior-trees+description: >+ Build NPC AI in Unreal Engine 5 with Behavior Trees and Blackboards: composites+ (Selector/Sequence), tasks, decorators, services, and running the tree from an AIController.+ Use when creating enemy/NPC AI, BT_/BB_ assets, custom BTTask or BTService nodes, or when+ the user mentions Behavior Tree, Blackboard, AIController, BTTask, decorator, or service.+license: Apache-2.0+compatibility: Unreal Engine 5.4+ (AIModule; Behavior Tree + Blackboard; NavMesh for movement)+metadata:+ engine: unreal+ category: unreal+ difficulty: advanced+---++# Unreal Behavior Trees++Author NPC decision-making in UE5 with Behavior Trees driven by a Blackboard: structure the+tree with composites, gate branches with decorators, keep state current with services, and run+it from an AIController. Targets **UE 5.4+**.++## When to use++- Use when building enemy/NPC AI: creating a `BT_`/`BB_` asset pair, structuring+ Selector/Sequence branches, adding decorators (conditions) and services (periodic updates),+ writing custom `BTTask`/`BTService` nodes, or wiring an AIController to run the tree.+- Use when the project has Behavior Tree (`BT_`) and Blackboard (`BB_`) assets and an+ `AAIController`.++**When *not* to use:** the *concept* of AI (FSM vs BT vs steering, cross-engine) →+`game-ai`. Pure navigation/pathing math is engine navmesh (BT's `MoveTo` uses it). Simple+one-off logic may be cheaper as a small state machine than a full tree.++## Core workflow++1. **Create the pair:** a Blackboard (`BB_`) holds typed keys (the AI's memory: `TargetActor`,+ `LastKnownLocation`, `bIsInvestigating`); a Behavior Tree (`BT_`) references that Blackboard.+2. **Possess and run.** An `AAIController` possesses the pawn and calls `RunBehaviorTree(BT)`,+ which also initializes the referenced Blackboard.+3. **Structure with composites.** **Selector** runs children left→right until one *succeeds*+ (priority/fallback: "attack, else chase, else patrol"). **Sequence** runs children until one+ *fails* (do-all: "move to cover → reload → peek"). **Simple Parallel** runs one main task+ alongside a secondary.+4. **Gate branches with Decorators** that read Blackboard keys (e.g. "Has Target?" guards the+ combat branch). Set **Observer Aborts** so the tree re-evaluates when the key changes.+5. **Keep the Blackboard current with Services** attached to a branch — they tick periodically+ (e.g. update `TargetActor` via a sight check) only while that branch is active.+6. **Do work in Tasks**, which return `Succeeded`, `Failed`, or `InProgress` (latent tasks like+ `MoveTo` finish later).+7. **Verify** with the Behavior Tree debugger during PIE — it highlights the running node and+ shows live Blackboard values, so you see exactly which branch executes.++## Patterns++### 1. AIController that runs the tree (C++)++```cpp+void AEnemyAIController::OnPossess(APawn* InPawn)+{+ Super::OnPossess(InPawn);+ if (BehaviorTree) // UPROPERTY(EditAnywhere) TObjectPtr<UBehaviorTree>+ RunBehaviorTree(BehaviorTree); // initializes & uses the Blackboard the BT references+}+```++### 2. A priority tree (node structure)++```text+ROOT+└── Selector (try combat, else investigate, else patrol)+ ├── Sequence [Decorator: Blackboard 'TargetActor' Is Set, Observer Aborts: Both]+ │ ├── Task: MoveTo (TargetActor) // latent: returns InProgress then Succeeded+ │ └── Task: Attack+ ├── Sequence [Decorator: 'LastKnownLocation' Is Set]+ │ ├── Task: MoveTo (LastKnownLocation)+ │ └── Task: Wait (3s) + clear key+ └── Task: Patrol (BTTask_FindPatrolPoint -> MoveTo)+```++`Observer Aborts: Both` makes the combat branch interrupt patrol the instant `TargetActor` is+set, and bail out when it's cleared — this is what makes the AI feel reactive.++### 3. Updating the Blackboard from code (e.g. on seeing the player)++```cpp+void AEnemyAIController::SetTarget(AActor* Target)+{+ if (UBlackboardComponent* BB = GetBlackboardComponent())+ BB->SetValueAsObject(TEXT("TargetActor"), Target); // key name must match the BB asset+}+// Clear with BB->ClearValue(TEXT("TargetActor")); to drop back to a lower-priority branch.+```++## Pitfalls++- **AI never starts** — the pawn isn't possessed (set the Pawn's *Auto Possess AI* to "Placed+ in World or Spawned" and assign the AIController), or `RunBehaviorTree` was never called.+- **`MoveTo` instantly fails** — no NavMesh in the level (add a Nav Mesh Bounds Volume), or the+ target is off the navmesh.+- **Branch doesn't react to changes** — the gating Decorator's **Observer Aborts** is set to+ None; set it to Self/Lower Priority/Both so the tree re-evaluates when the key changes.+- **A task hangs the tree** — a custom task returned `InProgress` and never calls+ `FinishLatentTask`. Always complete latent tasks.+- **Blackboard key typos** — `SetValueAsObject("Taget", ...)` silently does nothing; match the+ key name and type exactly, or use a cached `FBlackboardKeySelector`.+- **Sequence vs Selector confusion** — Sequence = AND (stops on first failure); Selector = OR+ (stops on first success). Swapping them inverts the behaviour.++## References++- For a **custom C++ `UBTTaskNode`** (instant and latent `ExecuteTask` returning `EBTNodeResult`,+ with a `FBlackboardKeySelector`), read `references/custom-bttask.md`.+- Primary docs: "Behavior Trees in Unreal Engine"+ (`https://dev.epicgames.com/documentation/en-us/unreal-engine/behavior-trees-in-unreal-engine`).++## Related skills++- `game-ai` — engine-agnostic AI design (FSM, BT, steering, pathfinding choices).+- `unreal-cpp-gameplay` — the AIController and pawn classes in C++.+- `fps-shooter` / `tower-defense` — genres that compose enemy AI.diff --git a/skills/unreal/unreal-behavior-trees/references/custom-bttask.md b/skills/unreal/unreal-behavior-trees/references/custom-bttask.mdnew file mode 100644index 0000000..c33d3dc--- /dev/null+++ b/skills/unreal/unreal-behavior-trees/references/custom-bttask.md@@ -0,0 +1,102 @@+# Custom BTTask in C++ (UE 5.4+)++Depth for `unreal-behavior-trees`: writing a custom Behavior Tree task node in C++. Verified+against the Behavior Trees documentation and the `UBTTaskNode` API. Requires the `AIModule`+dependency in `*.Build.cs`.++## Instant task (returns immediately)++```cpp+// BTTask_ClearTarget.h+#pragma once+#include "CoreMinimal.h"+#include "BehaviorTree/BTTaskNode.h"+#include "BTTask_ClearTarget.generated.h"++UCLASS()+class MYGAME_API UBTTask_ClearTarget : public UBTTaskNode+{+ GENERATED_BODY()+public:+ UBTTask_ClearTarget();+ virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& OwnerComp,+ uint8* NodeMemory) override;++ // Exposes a Blackboard key picker in the BT editor.+ UPROPERTY(EditAnywhere, Category = "Blackboard")+ FBlackboardKeySelector TargetKey;+};+```++```cpp+// BTTask_ClearTarget.cpp+#include "BTTask_ClearTarget.h"+#include "BehaviorTree/BlackboardComponent.h"++UBTTask_ClearTarget::UBTTask_ClearTarget()+{+ NodeName = "Clear Target";+}++EBTNodeResult::Type UBTTask_ClearTarget::ExecuteTask(UBehaviorTreeComponent& OwnerComp,+ uint8* NodeMemory)+{+ if (UBlackboardComponent* BB = OwnerComp.GetBlackboardComponent())+ {+ BB->ClearValue(TargetKey.SelectedKeyName);+ return EBTNodeResult::Succeeded; // done now+ }+ return EBTNodeResult::Failed;+}+```++`EBTNodeResult::Type` values: `Succeeded`, `Failed`, `Aborted`, `InProgress`.++## Latent task (finishes over time)++Return `InProgress`, then call `FinishLatentTask` when the work completes (e.g. a timer, an+async query, or a delegate callback).++```cpp+EBTNodeResult::Type UBTTask_WaitRandom::ExecuteTask(UBehaviorTreeComponent& OwnerComp,+ uint8* NodeMemory)+{+ AAIController* AICon = OwnerComp.GetAIOwner();+ if (!AICon) return EBTNodeResult::Failed;++ const float Delay = FMath::FRandRange(MinTime, MaxTime);++ // Schedule completion; capture the component so we can finish the right task instance.+ FTimerHandle Handle;+ AICon->GetWorldTimerManager().SetTimer(Handle, FTimerDelegate::CreateLambda(+ [&OwnerComp, this]()+ {+ FinishLatentTask(OwnerComp, EBTNodeResult::Succeeded); // resumes the tree+ }), Delay, /*loop*/ false);++ return EBTNodeResult::InProgress; // tree waits on this node until FinishLatentTask+}+```++If a latent task can be aborted by the tree (e.g. a higher-priority branch takes over),+override `AbortTask` to cancel timers/queries and return `EBTNodeResult::Aborted`.++## Reading and writing typed Blackboard values++```cpp+UBlackboardComponent* BB = OwnerComp.GetBlackboardComponent();+AActor* Target = Cast<AActor>(BB->GetValueAsObject(TargetKey.SelectedKeyName));+FVector Loc = BB->GetValueAsVector(TEXT("LastKnownLocation"));+BB->SetValueAsBool(TEXT("bIsInvestigating"), true);+```++## Notes++- Set `NodeName` in the constructor so the node reads clearly in the BT graph.+- `OwnerComp.GetAIOwner()` gives the `AAIController`; `GetAIOwner()->GetPawn()` the controlled+ pawn — use these instead of caching world pointers.+- For nodes that need per-instance memory (counters, handles), override `GetInstanceMemorySize`+ and use the `NodeMemory` block; for simple cases, member UPROPERTYs on a non-instanced node+ are shared across all uses, so prefer instance memory or instanced nodes when state matters.+- A custom **Service** subclasses `UBTService` and overrides `TickNode`; a custom **Decorator**+ subclasses `UBTDecorator` and overrides `CalculateRawConditionValue`.diff --git a/skills/unreal/unreal-blueprints/SKILL.md b/skills/unreal/unreal-blueprints/SKILL.mdnew file mode 100644index 0000000..feb2d40--- /dev/null+++ b/skills/unreal/unreal-blueprints/SKILL.md@@ -0,0 +1,127 @@+---+name: unreal-blueprints+description: >+ Build Unreal Engine 5 gameplay with Blueprint visual scripting: Blueprint Classes, the+ Event Graph and Construction Script, variables/functions/macros, and Blueprint+ communication (Cast, Interfaces, Event Dispatchers). Use when working in Blueprints, wiring+ an event graph, deciding how Blueprints talk to each other, or when the user mentions+ Blueprint, BP, event graph, construction script, or a Blueprint .uasset.+license: Apache-2.0+compatibility: Unreal Engine 5.4+ (docs verified against current UE5; Blueprint VM)+metadata:+ engine: unreal+ category: unreal+ difficulty: beginner+---++# Unreal Blueprints (Visual Scripting)++Structure gameplay logic in Unreal Engine 5 Blueprints: pick the right graph, expose data+cleanly, and choose a communication method that doesn't create hard-reference spaghetti.+Targets **UE 5.4+**. (Blueprints are node graphs; the snippets below describe node flows.)++## When to use++- Use when authoring a Blueprint Class, wiring the Event Graph (BeginPlay/Tick/overlap),+ using the Construction Script, creating variables/functions/macros, or choosing how two+ Blueprints communicate (Cast, Interface, or Event Dispatcher).+- Use when the project has `*.uproject` and Blueprint `*.uasset` files, and the user works+ visually rather than in C++.++**When *not* to use:** performance-critical systems, large data structures, or anything that+benefits from source control diffs and unit tests → `unreal-cpp-gameplay`. Player input+mapping → `unreal-enhanced-input`. AI logic → `unreal-behavior-trees`.++## Core workflow++1. **Choose the Blueprint type.** A **Blueprint Class** (derived from Actor/Pawn/Character/+ ActorComponent) defines a reusable object. The **Level Blueprint** is a per-level graph for+ level-specific scripting only — don't put reusable logic there.+2. **Use the Construction Script for editor-time setup** (procedural placement, configuring+ components from variables) — it runs when the actor is placed or edited, *not* during play.+3. **Use the Event Graph for runtime logic.** `Event BeginPlay` for init, input/overlap events+ for reactions. Avoid `Event Tick` unless you truly need per-frame work.+4. **Expose data with variables**; click the eye icon to make a variable Instance Editable, and+ group related ones with categories. Mark **pure** functions (no exec pin) for getters.+5. **Pick a communication method by coupling** (see Patterns): direct **Cast** for things you+ own, **Blueprint Interface** to call across types without hard references, **Event+ Dispatcher** to broadcast one-to-many.+6. **Verify** with the Blueprint debugger: drop breakpoints on nodes, watch variable values,+ and use Print String to confirm execution paths during Play In Editor (PIE).++## Patterns++### 1. Reactive Event Graph (no Tick)++```text+Event BeginPlay+ -> Set 'StartLocation' = GetActorLocation+ -> Bind Event to OnComponentBeginOverlap (TriggerVolume) [calls custom event OnEnterZone]++OnEnterZone (Other Actor)+ -> Branch: Other Actor == Player?+ True -> Open Door (Timeline drives the rotation) // event-driven, runs once+```++Prefer events (overlaps, timers, dispatchers) and Timelines over polling in Tick.++### 2. Direct reference + Cast (tight coupling, use sparingly)++```text+Overlapped Actor (Actor ref)+ -> Cast To BP_Player+ Cast Failed -> (do nothing)+ Success -> call BP_Player.ApplyDamage(10)+```++`Cast To` creates a hard reference to that class (it loads with this Blueprint). Fine when the+caller genuinely depends on that type; otherwise prefer an Interface.++### 3. Blueprint Interface (decoupled call)++```text+// 1. Create BPI_Interactable with function 'Interact(Instigator)'.+// 2. Add the interface to BP_Door, BP_Chest, BP_Lever and implement 'Interact' in each.+// 3. Caller, with any Actor ref:+Player presses Use+ -> Does Object Implement Interface (BPI_Interactable)? // safe check, no Cast/hard ref+ True -> Interact (Message) on Target Actor+```++### 4. Event Dispatcher (one-to-many broadcast)++```text+// In BP_Player: declare Event Dispatcher 'OnHealthChanged (float NewHealth)'.+TakeDamage -> Set Health -> Call 'OnHealthChanged' (Health) // broadcast++// In WBP_HUD BeginPlay: Bind Event to 'OnHealthChanged' -> update health bar.+// Many listeners can bind; the player never references them.+```++## Pitfalls++- **Cast spaghetti / long load times** — chains of `Cast To` create hard references that pull+ whole asset trees into memory. Decouple with Interfaces or Dispatchers.+- **Logic in the Level Blueprint that should be reusable** — it can't be reused across levels.+ Put it in a Blueprint Class.+- **`Event Tick` overuse** — every-frame nodes add up fast. Use events, Timers+ (`Set Timer by Event`), and Timelines instead.+- **Construction Script doing gameplay** — it runs in the editor on edit/placement; spawning+ gameplay actors or starting logic there causes editor-only artifacts. Init in BeginPlay.+- **Variable not visible on the instance** — toggle Instance Editable (the eye); to edit before+ spawn via Spawn node, also mark "Expose on Spawn".+- **Interface call did nothing** — the target doesn't implement the interface; use "Does+ Implement Interface" before calling, or use the Message version which is safe on non-implementers.++## References++- For a decision guide on **Cast vs Interface vs Event Dispatcher** and step-by-step dispatcher+ binding, read `references/communication.md`.+- Primary docs: "Blueprints Visual Scripting"+ (`https://dev.epicgames.com/documentation/en-us/unreal-engine/overview-of-blueprints-visual-scripting-in-unreal-engine`).++## Related skills++- `unreal-cpp-gameplay` — when to drop to C++; how BP and C++ classes interoperate.+- `unreal-enhanced-input` — the modern way to feed input events into these graphs.+- `unreal-behavior-trees` — AI decision logic that Blueprints trigger.diff --git a/skills/unreal/unreal-blueprints/references/communication.md b/skills/unreal/unreal-blueprints/references/communication.mdnew file mode 100644index 0000000..3907bc4--- /dev/null+++ b/skills/unreal/unreal-blueprints/references/communication.md@@ -0,0 +1,80 @@+# Blueprint communication: Cast vs Interface vs Event Dispatcher (UE 5.4+)++Depth for `unreal-blueprints`. The three ways Blueprints talk to each other, when to use each,+and the gotchas. Verified against the Blueprints Visual Scripting and Blueprint Communications+documentation.++## Decision guide++| Method | Direction | Coupling | Use when |+|--------|-----------|----------|----------|+| **Direct + Cast To** | caller → known target | hard (loads that class) | you have a reference and genuinely depend on that exact type (e.g. player calls a specific door it owns) |+| **Blueprint Interface** | caller → any implementer | loose (no hard ref) | many unrelated types share a verb (Interact, Damage, Save) and the caller shouldn't know concrete types |+| **Event Dispatcher** | source → many listeners | loose (listeners find source) | one event, many reactions (health changed → HUD + audio + achievements) |++Rule of thumb: **Cast down, broadcast up.** A manager can Cast to things it owns; a low-level+actor should broadcast a Dispatcher rather than reach up to its owner.++## Casting — the cost++`Cast To BP_X` adds `BP_X` (and its dependencies) to this Blueprint's load references. A web of+casts inflates memory and load times and is a common cause of "why does my small Blueprint pull+in half the game". Use it where the dependency is real; otherwise prefer an interface.++```text+Some Actor ref -> Cast To BP_Enemy+ Cast Failed (exec) -> skip // always handle failure; a wrong-type ref returns invalid+ As BP_Enemy (success) -> call enemy-specific function+```++## Blueprint Interface — decoupled verbs++1. Content Browser → Blueprint → **Blueprint Interface** (e.g. `BPI_Interactable`).+2. Add a function signature, e.g. `Interact(AActor* Instigator)`. (Interfaces declare signatures+ only — no node implementation in the interface asset.)+3. In each implementer (BP_Door, BP_Chest): Class Settings → **Implemented Interfaces** → add+ `BPI_Interactable`, then implement the `Interact` event in its Event Graph.+4. Caller, holding any `AActor` reference:++```text+-> Does Object Implement Interface (BPI_Interactable)? // optional guard+ True -> Interact (Message) [Target = the actor] // 'Message' node is safe even if not implemented+```++The "Message" call node does nothing on actors that don't implement the interface, so it never+errors — unlike a Cast that fails.++## Event Dispatcher — one-to-many++Declare on the source Blueprint (e.g. `BP_Player`): My Blueprint panel → Event Dispatchers →+add `OnHealthChanged` with a `float NewHealth` input.++Broadcast it where the state changes:++```text+ApplyDamage -> Set Health (clamp >= 0) -> Call 'OnHealthChanged' (NewHealth = Health)+```++Bind from any listener that has a reference to the source:++```text+WBP_HUD :: Event Construct+ -> Get Player Pawn -> Cast To BP_Player+ -> Bind Event to 'OnHealthChanged' [Event = custom 'HandleHealth(NewHealth)']++HandleHealth(NewHealth) -> Set Progress Bar Percent = NewHealth / MaxHealth+```++- Multiple listeners can bind to the same dispatcher; all are called on broadcast.+- **Unbind** (`Unbind Event from ...`) when a listener is destroyed/hidden to avoid stale binds.+- Dispatchers are the Blueprint equivalent of a C++ multicast delegate+ (`DECLARE_DYNAMIC_MULTICAST_DELEGATE`), so the same actor's event can be bound from C++ too.++## Gotchas++- Binding inside `Event Construct`/`BeginPlay` requires the source to already exist; for+ spawn-order issues, bind after you spawn the source, or have the source broadcast an initial+ value once listeners are known.+- Interface functions with return values are implemented as functions (not events) on the+ implementer; pure interface calls can't have exec pins.+- Casting a soft reference forces a synchronous load; prefer `Async Load Asset` for soft refs.diff --git a/skills/unreal/unreal-cpp-gameplay/SKILL.md b/skills/unreal/unreal-cpp-gameplay/SKILL.mdnew file mode 100644index 0000000..751bfbc--- /dev/null+++ b/skills/unreal/unreal-cpp-gameplay/SKILL.md@@ -0,0 +1,150 @@+---+name: unreal-cpp-gameplay+description: >+ Write Unreal Engine 5 C++ gameplay code: the UCLASS/UPROPERTY/UFUNCTION reflection macros,+ the Gameplay Framework (GameMode, Pawn, Character, PlayerController, Actor components), and+ the module Build.cs. Use when writing or debugging UE C++, deriving from AActor/ACharacter/+ AGameModeBase, exposing properties to the editor or Blueprints, or when the user mentions+ Unreal C++, UCLASS, GENERATED_BODY, GameMode, ACharacter, or .Build.cs.+license: Apache-2.0+compatibility: Unreal Engine 5.4+ (docs verified against current UE5); C++17 toolchain+metadata:+ engine: unreal+ category: unreal+ difficulty: advanced+---++# Unreal C++ Gameplay++Write correct UE5 gameplay C++: the reflection macros that connect C++ to the editor and+Blueprints, the Gameplay Framework class roles, and module dependencies. Targets **UE 5.4+**.++## When to use++- Use when creating C++ gameplay classes (`AActor`, `APawn`, `ACharacter`, `AGameModeBase`,+ `UActorComponent`), exposing properties/functions with `UPROPERTY`/`UFUNCTION`, setting up a+ GameMode's default classes, or adding a module dependency in `*.Build.cs`.+- Use when the project has a `Source/` tree with `*.h`/`*.cpp` using `UCLASS`, and `*.Build.cs`.++**When *not* to use:** designer-facing visual logic → `unreal-blueprints`. Player input+binding details → `unreal-enhanced-input`. AI logic → `unreal-behavior-trees`. This skill owns+the C++ class/reflection foundation those build on.++## Core workflow++1. **Name with the right prefix.** `A` = Actor-derived, `U` = `UObject`/component-derived,+ `F` = plain struct, `E` = enum, `I` = interface. The prefix must match the base class.+2. **Declare the class with reflection macros.** `UCLASS()` above the class, `GENERATED_BODY()`+ as the first line in the body, and `#include "ClassName.generated.h"` as the **last**+ include in the header.+3. **Expose data with `UPROPERTY`** (editor/Blueprint visibility *and* garbage-collection+ tracking) and behaviour with `UFUNCTION` (`BlueprintCallable`, etc.).+4. **Create components in the constructor** with `CreateDefaultSubobject<T>(TEXT("Name"))` and+ set the `RootComponent`.+5. **Know the framework roles:** `AGameModeBase` sets the rules + default classes; `APawn`/+ `ACharacter` is the controllable body; `APlayerController` is the player's will;+ `UActorComponent` is reusable behaviour.+6. **Add module dependencies** to `*.Build.cs` (e.g. `EnhancedInput`) or unresolved-symbol+ link errors follow.+7. **Verify** by compiling (Live Coding `Ctrl+Alt+F11` for function bodies; full rebuild for+ header/UPROPERTY changes) and checking the class/properties appear in the editor.++## Patterns++### 1. Minimal Actor class (header + source)++```cpp+// Pickup.h+#pragma once+#include "CoreMinimal.h"+#include "GameFramework/Actor.h"+#include "Pickup.generated.h" // MUST be the last include++UCLASS()+class MYGAME_API APickup : public AActor // MYGAME_API = your module's export macro+{+ GENERATED_BODY()+public:+ APickup();++ // EditAnywhere = tweak per-instance & on the CDO; BlueprintReadWrite = BP get/set.+ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pickup")+ int32 ScoreValue = 10;++ // UPROPERTY on a UObject* pointer is what keeps it from being garbage-collected.+ UPROPERTY(VisibleAnywhere)+ TObjectPtr<UStaticMeshComponent> Mesh; // UE5: TObjectPtr instead of raw UStaticMeshComponent*++ UFUNCTION(BlueprintCallable, Category = "Pickup")+ void Collect();++protected:+ virtual void BeginPlay() override;+};+```++```cpp+// Pickup.cpp+#include "Pickup.h"+#include "Components/StaticMeshComponent.h"++APickup::APickup()+{+ Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));+ RootComponent = Mesh; // the mesh is this actor's root+}++void APickup::BeginPlay() { Super::BeginPlay(); } // always call Super+void APickup::Collect() { Destroy(); }+```++### 2. GameMode wiring its default classes++```cpp+// MyGameMode.cpp — set in the constructor so the engine spawns your classes.+AMyGameMode::AMyGameMode()+{+ DefaultPawnClass = AMyCharacter::StaticClass();+ PlayerControllerClass = AMyPlayerController::StaticClass();+}+```++### 3. Module dependency in Build.cs++```csharp+// MyGame.Build.cs+PublicDependencyModuleNames.AddRange(new string[]+{+ "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput"+});+```++## Pitfalls++- **`generated.h` not last / missing** — compile errors like "Cannot find generated header" or+ "Expected an include". It must be the final include in the header.+- **Forgetting `GENERATED_BODY()`** — UHT (Unreal Header Tool) errors; it must be the first+ thing inside the class body.+- **Raw `UObject*` without `UPROPERTY`** — the garbage collector doesn't see it and may destroy+ it out from under you. Track every UObject pointer with `UPROPERTY` (use `TObjectPtr` in UE5).+- **Header/UPROPERTY edits with Live Coding** — Live Coding handles function bodies, but+ changes to `UCLASS`/`UPROPERTY`/headers need a full editor restart + rebuild.+- **Wrong class prefix** — naming an Actor `UFoo` (or a component `AFoo`) breaks UHT; match the+ prefix to the base type.+- **Unresolved external symbol at link** — the module providing the API isn't in `Build.cs`+ `PublicDependencyModuleNames`.+- **Not calling `Super::`** in overridden `BeginPlay`/`Tick`/etc. skips engine setup.++## References++- For `UActorComponent` creation/attachment, the `UPROPERTY` garbage-collection ownership rules+ (`TObjectPtr`, `TArray<TObjectPtr<>>`, `AddToRoot`), and a replication primer, read+ `references/components-and-gc.md`.+- Primary docs: "Unreal Engine CPP Quick Start" and "Gameplay Framework"+ (`https://dev.epicgames.com/documentation/en-us/unreal-engine/gameplay-framework-in-unreal-engine`).++## Related skills++- `unreal-blueprints` — exposing C++ to designers; BP/C++ interop.+- `unreal-enhanced-input` — binding input in a C++ Pawn/Character.+- `unreal-behavior-trees` — C++ AI tasks driven from a behaviour tree.diff --git a/skills/unreal/unreal-cpp-gameplay/references/components-and-gc.md b/skills/unreal/unreal-cpp-gameplay/references/components-and-gc.mdnew file mode 100644index 0000000..84bb7fa--- /dev/null+++ b/skills/unreal/unreal-cpp-gameplay/references/components-and-gc.md@@ -0,0 +1,105 @@+# Components, garbage collection & replication primer (UE 5.4+ C++)++Depth for `unreal-cpp-gameplay`. Verified against the Gameplay Framework docs and the UE5+C++ programming references. Covers component creation/attachment, the UPROPERTY/GC ownership+rules that trip up newcomers, and a minimal replication example.++## Creating and attaching components++Default subobjects are created in the constructor; runtime components use `NewObject` ++`RegisterComponent`.++```cpp+// In the constructor — built into the Class Default Object, editable in the Blueprint subclass.+ACharacterBase::ACharacterBase()+{+ SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArm"));+ SpringArm->SetupAttachment(RootComponent); // attach to an existing component+ SpringArm->TargetArmLength = 300.f;++ Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));+ Camera->SetupAttachment(SpringArm); // socket chain: root -> arm -> camera+}+```++```cpp+// At runtime (e.g. add a component after spawn):+UAudioComponent* Audio = NewObject<UAudioComponent>(this);+Audio->RegisterComponent(); // required, or it won't tick/render+Audio->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);+```++- `CreateDefaultSubobject` is **only** valid in a constructor; using it later asserts.+- `SetupAttachment` is for constructor-time hierarchy; `AttachToComponent` is the runtime call.++## Garbage collection ownership (the #1 newcomer crash)++The UE garbage collector only keeps `UObject`s alive if it can reach them through a reflected+reference. A raw `UObject*` member that isn't a `UPROPERTY` is invisible to the GC and can be+collected, leaving a dangling pointer.++```cpp+UPROPERTY() // GC sees it -> stays alive while this owner lives+TObjectPtr<UMyDataObject> Data;++UPROPERTY()+TArray<TObjectPtr<AActor>> Tracked; // containers of UObjects also need UPROPERTY++UMyDataObject* Raw; // BUG: not tracked; may be GC'd -> crash+```++Rules:+- Every `UObject`/Actor pointer that must persist gets a `UPROPERTY` (use `TObjectPtr<T>` in+ UE5; raw pointers still compile but `TObjectPtr` adds access tracking in the editor).+- Plain C++ data (ints, FStrings, FVectors, USTRUCTs of POD) doesn't need this — it's owned by+ value.+- For a UObject you create that has no UPROPERTY owner (rare), `AddToRoot()` pins it and+ `RemoveFromRoot()` releases it — but prefer proper ownership.++## USTRUCT and UENUM for reflected data++```cpp+UENUM(BlueprintType)+enum class EWeaponType : uint8 { Pistol, Rifle, Shotgun };++USTRUCT(BlueprintType)+struct FWeaponStats+{+ GENERATED_BODY()+ UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 Damage = 10;+ UPROPERTY(EditAnywhere, BlueprintReadWrite) float FireRate = 0.25f;+};+```++`BlueprintType` makes the enum/struct usable as Blueprint variables.++## Minimal replication (multiplayer)++```cpp+// Header+UPROPERTY(ReplicatedUsing = OnRep_Health)+float Health = 100.f;++UFUNCTION()+void OnRep_Health(); // client callback when Health replicates++// Source+#include "Net/UnrealNetwork.h"+void AMyActor::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& Out) const+{+ Super::GetLifetimeReplicatedProps(Out);+ DOREPLIFETIME(AMyActor, Health); // register the property for replication+}+```++- Set `bReplicates = true;` in the constructor for the actor to replicate at all.+- Server authority: gameplay changes happen on the server; clients receive replicated state and+ react in `OnRep_` callbacks.++## Gotchas++- `NewObject` without `RegisterComponent` gives a component that exists but never ticks or+ renders.+- Forgetting `#include "Net/UnrealNetwork.h"` breaks `DOREPLIFETIME`.+- `TObjectPtr` implicitly converts to the raw pointer for calls, so existing `->`/`.` usage is+ unchanged; the difference is GC visibility and editor tooling, not syntax at call sites.diff --git a/skills/unreal/unreal-enhanced-input/SKILL.md b/skills/unreal/unreal-enhanced-input/SKILL.mdnew file mode 100644index 0000000..d3c803d--- /dev/null+++ b/skills/unreal/unreal-enhanced-input/SKILL.md@@ -0,0 +1,131 @@+---+name: unreal-enhanced-input+description: >+ Set up player input in Unreal Engine 5 with Enhanced Input: Input Actions, Input Mapping+ Contexts, modifiers and triggers, adding the mapping context, and binding actions by+ ETriggerEvent. Use when wiring movement/look/jump input, creating IA_/IMC_ assets, binding+ in C++ or Blueprints, or when the user mentions Enhanced Input, Input Mapping Context,+ Input Action, IA_/IMC_, or ETriggerEvent.+license: Apache-2.0+compatibility: Unreal Engine 5.4+ (Enhanced Input is the default UE5 input system)+metadata:+ engine: unreal+ category: unreal+ difficulty: intermediate+---++# Unreal Enhanced Input++Wire player input the modern UE5 way with the **Enhanced Input** system: data-driven Input+Actions and Mapping Contexts instead of the legacy Project Settings axis/action mappings.+Targets **UE 5.4+** (Enhanced Input is the default; legacy input is deprecated).++## When to use++- Use when adding movement/look/jump/fire input, creating Input Action (`IA_`) and Input+ Mapping Context (`IMC_`) assets, applying modifiers/triggers, adding a mapping context to a+ player, or binding actions in C++ or Blueprints.+- Use when the project has `IA_*`/`IMC_*` assets or references `EnhancedInput`.++**When *not* to use:** engine-agnostic input *architecture* (rebinding strategy, buffering,+multi-device design) → `input-systems`. The Pawn/Character C++ those bindings live in →+`unreal-cpp-gameplay`.++## Core workflow++1. **Enable the module/plugin.** Enhanced Input is on by default in UE5; for C++ binding add+ `"EnhancedInput"` to `PublicDependencyModuleNames` in `*.Build.cs`.+2. **Create Input Actions (`IA_`).** Each has a **Value Type**: `Digital (bool)` for buttons,+ `Axis1D (float)` for triggers, `Axis2D (Vector2D)` for movement/look.+3. **Create an Input Mapping Context (`IMC_`)** that maps keys/buttons to those actions. Use+ **Modifiers** to shape raw input (Negate, Swizzle Input Axis Values, Dead Zone) — e.g. WASD+ into one Axis2D needs Negate on A/S and a Swizzle on W/S. Use **Triggers** (Pressed, Hold,+ Tap) to decide *when* an action fires.+4. **Add the mapping context to the player** via the `EnhancedInputLocalPlayerSubsystem`+ (`AddMappingContext(IMC, Priority)`), usually in `BeginPlay`/possession.+5. **Bind actions** to handlers by `ETriggerEvent` (`Triggered`, `Started`, `Completed`, …) on+ the `EnhancedInputComponent`, and read the `FInputActionValue` in the handler.+6. **Verify** in PIE; the Enhanced Input debugging console commands+ (`showdebug enhancedinput`) show which actions trigger and their values.++## Patterns++### 1. Add the mapping context (C++ Character)++```cpp+void AMyCharacter::BeginPlay()+{+ Super::BeginPlay();+ if (APlayerController* PC = Cast<APlayerController>(GetController()))+ if (ULocalPlayer* LP = PC->GetLocalPlayer())+ if (auto* Subsystem = LP->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>())+ Subsystem->AddMappingContext(DefaultMappingContext, /*Priority*/ 0);+}+// DefaultMappingContext is a UPROPERTY(EditAnywhere) TObjectPtr<UInputMappingContext>.+```++### 2. Bind actions and read values++```cpp+void AMyCharacter::SetupPlayerInputComponent(UInputComponent* InputComponent)+{+ Super::SetupPlayerInputComponent(InputComponent);++ // The component is an Enhanced Input component when the plugin is active.+ if (UEnhancedInputComponent* EIC = Cast<UEnhancedInputComponent>(InputComponent))+ {+ EIC->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AMyCharacter::Move);+ EIC->BindAction(LookAction, ETriggerEvent::Triggered, this, &AMyCharacter::Look);+ EIC->BindAction(JumpAction, ETriggerEvent::Started, this, &ACharacter::Jump);+ EIC->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);+ }+}++void AMyCharacter::Move(const FInputActionValue& Value)+{+ const FVector2D Axis = Value.Get<FVector2D>(); // Axis2D action+ AddMovementInput(GetActorForwardVector(), Axis.Y);+ AddMovementInput(GetActorRightVector(), Axis.X);+}+```++### 3. Blueprint equivalent (node flow)++```text+Event BeginPlay+ -> Get Controller -> Cast To PlayerController -> Get Local Player+ -> Get EnhancedInputLocalPlayerSubsystem -> Add Mapping Context (IMC_Default, Priority 0)++// IA_Move is exposed as its own event node in the Character's Event Graph:+EnhancedInputAction IA_Move (Triggered)+ -> Action Value (Vector2D) -> Add Movement Input (Forward * Y, Right * X)+```++## Pitfalls++- **No input at all** — the mapping context was never added (`AddMappingContext`), or the+ player has no Local Player yet. Add it after possession/`BeginPlay`.+- **Link/compile error binding in C++** — `"EnhancedInput"` isn't in `Build.cs`+ `PublicDependencyModuleNames`.+- **WASD only moves on two keys / wrong axis** — Axis2D needs **Modifiers**: Negate on the+ negative keys (A, S) and a Swizzle Input Axis Values on the vertical (W/S) so both axes map+ correctly. Raw bindings without modifiers misbehave.+- **`Get<FVector2D>()` returns zero** — value-type mismatch: the Input Action is Digital/Axis1D,+ not Axis2D. Match the `Get<T>()` to the action's Value Type.+- **Action fires every frame unexpectedly** — `Triggered` repeats while held for a Down trigger;+ use `Started`/`Completed` for one-shots (jump press/release), or a Pressed/Tap trigger.+- **Two contexts fight** — multiple mapping contexts stack by Priority; a higher-priority+ context can consume a key. Manage with priorities and `RemoveMappingContext`.++## References++- For a complete first-/third-person C++ Character with Enhanced Input (header + source,+ including look/jump and a control-rebind note), read `references/cpp-setup.md`.+- Primary docs: "Enhanced Input in Unreal Engine"+ (`https://dev.epicgames.com/documentation/en-us/unreal-engine/enhanced-input-in-unreal-engine`).++## Related skills++- `input-systems` — engine-agnostic input architecture and rebinding strategy.+- `unreal-cpp-gameplay` — the Character/Pawn class and module setup.+- `fps-shooter` — composes input with a 3D controller and shooting.diff --git a/skills/unreal/unreal-enhanced-input/references/cpp-setup.md b/skills/unreal/unreal-enhanced-input/references/cpp-setup.mdnew file mode 100644index 0000000..8e04cf5--- /dev/null+++ b/skills/unreal/unreal-enhanced-input/references/cpp-setup.md@@ -0,0 +1,129 @@+# Enhanced Input — complete C++ Character (UE 5.4+)++Depth for `unreal-enhanced-input`: a self-contained third-person Character that adds a mapping+context and binds move/look/jump. Verified against the Enhanced Input documentation.++## Header++```cpp+// MyCharacter.h+#pragma once+#include "CoreMinimal.h"+#include "GameFramework/Character.h"+#include "MyCharacter.generated.h"++class UInputMappingContext;+class UInputAction;+struct FInputActionValue;++UCLASS()+class MYGAME_API AMyCharacter : public ACharacter+{+ GENERATED_BODY()+public:+ AMyCharacter();++protected:+ virtual void BeginPlay() override;+ virtual void SetupPlayerInputComponent(UInputComponent* InputComponent) override;++ // Assign these in the Blueprint subclass (IMC_/IA_ assets).+ UPROPERTY(EditAnywhere, Category = "Input")+ TObjectPtr<UInputMappingContext> DefaultMappingContext;++ UPROPERTY(EditAnywhere, Category = "Input")+ TObjectPtr<UInputAction> MoveAction;++ UPROPERTY(EditAnywhere, Category = "Input")+ TObjectPtr<UInputAction> LookAction;++ UPROPERTY(EditAnywhere, Category = "Input")+ TObjectPtr<UInputAction> JumpAction;++ void Move(const FInputActionValue& Value);+ void Look(const FInputActionValue& Value);+};+```++## Source++```cpp+// MyCharacter.cpp+#include "MyCharacter.h"+#include "EnhancedInputComponent.h"+#include "EnhancedInputSubsystems.h"+#include "InputActionValue.h"++AMyCharacter::AMyCharacter()+{+ // (camera/spring-arm setup omitted — see unreal-cpp-gameplay references)+}++void AMyCharacter::BeginPlay()+{+ Super::BeginPlay();+ if (APlayerController* PC = Cast<APlayerController>(GetController()))+ if (ULocalPlayer* LP = PC->GetLocalPlayer())+ if (UEnhancedInputLocalPlayerSubsystem* Subsystem =+ LP->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>())+ Subsystem->AddMappingContext(DefaultMappingContext, 0);+}++void AMyCharacter::SetupPlayerInputComponent(UInputComponent* InputComponent)+{+ Super::SetupPlayerInputComponent(InputComponent);+ if (UEnhancedInputComponent* EIC = Cast<UEnhancedInputComponent>(InputComponent))+ {+ EIC->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AMyCharacter::Move);+ EIC->BindAction(LookAction, ETriggerEvent::Triggered, this, &AMyCharacter::Look);+ EIC->BindAction(JumpAction, ETriggerEvent::Started, this, &ACharacter::Jump);+ EIC->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);+ }+}++void AMyCharacter::Move(const FInputActionValue& Value)+{+ const FVector2D Axis = Value.Get<FVector2D>();+ if (Controller)+ {+ // Move relative to where the controller is facing (yaw only).+ const FRotator Yaw(0, Controller->GetControlRotation().Yaw, 0);+ AddMovementInput(FRotationMatrix(Yaw).GetUnitAxis(EAxis::X), Axis.Y);+ AddMovementInput(FRotationMatrix(Yaw).GetUnitAxis(EAxis::Y), Axis.X);+ }+}++void AMyCharacter::Look(const FInputActionValue& Value)+{+ const FVector2D Axis = Value.Get<FVector2D>();+ AddControllerYawInput(Axis.X);+ AddControllerPitchInput(Axis.Y);+}+```++## Build.cs++```csharp+PublicDependencyModuleNames.AddRange(new string[]+{+ "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput"+});+```++## Asset setup checklist (editor)++1. `IA_Move` — Value Type **Axis2D**; `IA_Look` — Axis2D; `IA_Jump` — **Digital (bool)**.+2. `IMC_Default` mappings:+ - `IA_Move`: W (no modifier), S (**Negate**), and a **Swizzle Input Axis Values** on the+ up/down keys so vertical maps to Y; A (**Negate**), D for X.+ - `IA_Look`: Mouse XY (add **Negate** on Y if inverted); gamepad right stick.+ - `IA_Jump`: Space Bar / gamepad face button.+3. In the Blueprint subclass of `AMyCharacter`, assign `DefaultMappingContext` and the three+ `IA_` assets.++## Runtime rebinding note++Enhanced Input supports **Player Mappable Key Settings** on an Input Action plus the+`UEnhancedInputUserSettings` subsystem to remap and persist keys at runtime — the supported+path for a "rebind controls" menu in UE5. Mark the action's mapping as Player Mappable and+query/modify it through that subsystem rather than editing the `IMC_` asset.diff --git a/skills/unreal/unreal-niagara/SKILL.md b/skills/unreal/unreal-niagara/SKILL.mdnew file mode 100644index 0000000..eba2ae1--- /dev/null+++ b/skills/unreal/unreal-niagara/SKILL.md@@ -0,0 +1,129 @@+---+name: unreal-niagara+description: >+ Create and control VFX in Unreal Engine 5 with Niagara: systems and emitters, modules and+ the spawn/update stages, exposed User parameters, and spawning or driving effects from+ Blueprints or C++. Use when building particle effects, NS_/NE_ assets, spawning a Niagara+ system at runtime, setting User parameters, or when the user mentions Niagara, VFX, or a+ particle system in Unreal.+license: Apache-2.0+compatibility: Unreal Engine 5.4+ (Niagara is the current VFX system; Cascade is legacy)+metadata:+ engine: unreal+ category: unreal+ difficulty: advanced+---++# Unreal Niagara VFX++Build and control real-time visual effects in UE5 with Niagara: understand the+System/Emitter/Module hierarchy, expose parameters you can drive from gameplay, and spawn+effects at runtime. Targets **UE 5.4+**. (Niagara replaces the legacy Cascade system.)++## When to use++- Use when creating a Niagara System (`NS_`) and Emitters (`NE_`), wiring modules in the+ spawn/update stages, exposing **User** parameters to gameplay, or spawning/driving an effect+ (impact, muzzle flash, fire, magic) from Blueprint or C++.+- Use when the project has Niagara `NS_`/`NE_` assets or references `UNiagaraComponent`.++**When *not* to use:** material/shader authoring (the look of a surface, not particles) is a+separate topic; `shader-programming` covers cross-engine shader concepts. Audio for the effect+→ `audio-design`.++## Core workflow++1. **Understand the hierarchy.** A **Niagara System** (`NS_`) is the effect you place/spawn; it+ contains one or more **Emitters** (`NE_`, often emitter *templates*). Each emitter runs in+ stages: **Emitter Spawn/Update**, **Particle Spawn/Update**, optional **Event Handler**, and+ **Render**.+2. **Build behaviour from Modules**, which execute top-to-bottom in each stage (Spawn Rate,+ Add Velocity, Gravity Force, Color over Life, etc.). Order matters — a later module reads the+ values earlier ones wrote.+3. **Know the parameter namespaces:** `System`, `Emitter`, `Particle`, and **`User`**. Only+ **User-namespace** parameters are exposed to and settable from Blueprint/C++; the others are+ internal to the simulation.+4. **Spawn at runtime** with `UNiagaraFunctionLibrary::SpawnSystemAtLocation` (world position)+ or `SpawnSystemAttached` (follows a component/socket), which return a `UNiagaraComponent`.+5. **Drive the effect** by setting its User parameters on the returned component (color, spawn+ rate, a target position) and `Activate`/`Deactivate` it.+6. **Verify** in the Niagara editor preview and in-level; check bounds (especially GPU+ emitters), and confirm the effect culls/destroys correctly.++## Patterns++### 1. Spawn a one-shot effect at a world location (C++)++```cpp+#include "NiagaraFunctionLibrary.h"+#include "NiagaraComponent.h"++// ImpactSystem is a UPROPERTY(EditAnywhere) TObjectPtr<UNiagaraSystem>.+void AProjectile::SpawnImpact(const FVector& Location, const FRotator& Rotation)+{+ UNiagaraComponent* FX = UNiagaraFunctionLibrary::SpawnSystemAtLocation(+ GetWorld(), ImpactSystem, Location, Rotation);+ // FX auto-destroys when finished for a one-shot (system marked non-looping).+}+```++### 2. Spawn attached to a socket (muzzle flash that follows the gun)++```cpp+UNiagaraComponent* Muzzle = UNiagaraFunctionLibrary::SpawnSystemAttached(+ MuzzleSystem, WeaponMesh, FName("MuzzleSocket"),+ FVector::ZeroVector, FRotator::ZeroRotator,+ EAttachLocation::SnapToTarget, /*bAutoDestroy*/ true);+```++### 3. Drive an exposed User parameter at runtime++```cpp+// Only User-namespace parameters can be set from gameplay. Names match the User parameter.+if (UNiagaraComponent* Fire = UNiagaraFunctionLibrary::SpawnSystemAttached(+ FireSystem, RootComponent, NAME_None, FVector::ZeroVector, FRotator::ZeroRotator,+ EAttachLocation::KeepRelativeOffset, /*bAutoDestroy*/ false))+{+ Fire->SetVariableFloat(FName("SpawnRate"), 250.f); // User.SpawnRate+ Fire->SetVariableLinearColor(FName("FireColor"), FLinearColor::Red);+}+```++### 4. Blueprint equivalent (node flow)++```text+Spawn System at Location (System = NS_Impact, Location, Rotation) -> returns Niagara Component+On the returned component:+ Set Niagara Variable (Float) Name="SpawnRate" Value=250+ Set Niagara Variable (LinearColor) Name="FireColor" Value=Red+```++## Pitfalls++- **Trying to set a System/Emitter/Particle parameter from gameplay** — it won't take. Expose+ it in the **User** namespace; only User parameters are settable via the component.+- **Using Cascade tutorials** — Cascade is legacy/deprecated. Niagara is the current system; the+ emitter/module workflow differs.+- **Effect disappears or doesn't cull right** — fixed/incorrect bounds, especially for **GPU+ Compute** emitters which need explicit Fixed Bounds. Set bounds on the emitter/system.+- **Looping effect never stops** — spawned with `bAutoDestroy = false` and never+ `Deactivate()`d; manage the returned component's lifetime, or mark the system non-looping for+ one-shots.+- **GPU sim can't drive gameplay** — GPU particle data isn't readily read back to the CPU;+ collision/events that gameplay must react to should use CPU emitters (or Niagara → gameplay+ via the data interface), not GPU.+- **Module order bugs** — a Force/Velocity module placed before the one that initializes the+ value reads zero. Mind the top-to-bottom stack order.++## References++- Primary docs: "Overview of Niagara Effects"+ (`https://dev.epicgames.com/documentation/en-us/unreal-engine/overview-of-niagara-effects-for-unreal-engine`)+ and the `UNiagaraFunctionLibrary` / `UNiagaraComponent` API. Add the `Niagara` module to+ `*.Build.cs` for C++ access.++## Related skills++- `shader-programming` — material/shader concepts for particle materials.+- `unreal-cpp-gameplay` — spawning effects from gameplay code and module setup.+- `unreal-blueprints` — triggering effects from visual scripts.diff --git a/skills/unreal/unreal-packaging/SKILL.md b/skills/unreal/unreal-packaging/SKILL.mdnew file mode 100644index 0000000..2e1c610--- /dev/null+++ b/skills/unreal/unreal-packaging/SKILL.md@@ -0,0 +1,113 @@+---+name: unreal-packaging+description: >+ Package and ship an Unreal Engine 5 project: the Platforms menu Package Project flow, build+ configurations (Development vs Shipping), cooking content, packaging settings and the Game+ Default Map, and command-line builds with RunUAT BuildCookRun. Use when packaging a build,+ making a shipping build, cooking content, configuring packaging settings, or when the user+ mentions package Unreal, cook content, shipping build, or BuildCookRun.+license: Apache-2.0+compatibility: Unreal Engine 5.4+; desktop/console/mobile packaging via UAT+metadata:+ engine: unreal+ category: unreal+ difficulty: intermediate+---++# Unreal Packaging & Cooking++Turn a UE5 project into a runnable, distributable build: choose the right build configuration,+cook content, set the launch map, and package — from the editor or the command line. Targets+**UE 5.4+**.++## When to use++- Use when producing a build (test or release), choosing Development vs Shipping, cooking+ content, configuring Packaging / Maps & Modes settings, or automating builds with+ `RunUAT BuildCookRun` for CI.+- Use when the project has a `*.uproject` and `Config/Default*.ini`, and the goal is a packaged+ player rather than running in-editor.++**When *not* to use:** storefront submission/release process → `steam-publish` / `itch-publish`.+Editor-time gameplay/iteration is not packaging.++## Core workflow++1. **Set the launch map.** Project Settings → **Maps & Modes** → **Game Default Map** is what a+ packaged build loads first. Wrong/empty here is the most common "packaged game is black"+ cause.+2. **Pick the build configuration:** **Development** (default; optimized but keeps logging/+ stats/console for testing) vs **Shipping** (all optimizations, debugging tools stripped — for+ release). `DebugGame`/`Debug` are for debugging engine/game code and aren't for distribution;+ `DebugGame` isn't available for Blueprint-only projects.+3. **Understand cook vs package.** **Cooking** converts assets to the target platform's format+ and packs them into `.pak` files. **Packaging** bundles the compiled executable + cooked+ content into a standalone, distributable set of files. Packaging runs a cook as part of it.+4. **Package from the editor:** the **Platforms** menu → choose the platform (e.g. Windows) →+ set the Binary Configuration → **Package Project** → pick an output folder.+5. **Or build from the command line** with the Unreal Automation Tool (`RunUAT BuildCookRun`)+ for repeatable/CI builds.+6. **Tune Packaging settings** (Project Settings → **Packaging**): which maps/directories to+ cook, full-rebuild, compression, and whether to build all maps.+7. **Verify** by *running the packaged build*, not just by a successful cook — launch the+ executable and confirm it loads the right map and runs.++## Patterns++### 1. Editor packaging (the menu path)++```text+Platforms (toolbar)+ -> Windows+ -> Binary Configuration -> Development | Shipping+ -> Content Management -> Package Project+ -> choose/confirm the staging output folder+```++### 2. Command-line build with UAT (CI-friendly)++```bash+# Cook + build + stage + pak + archive a Shipping Windows build.+RunUAT BuildCookRun \+ -project="C:/Path/MyGame.uproject" \+ -noP4 -platform=Win64 -clientconfig=Shipping \+ -cook -allmaps -build -stage -pak -archive \+ -archivedirectory="C:/Builds/MyGame"+```++`RunUAT` lives in `Engine/Build/BatchFiles/` (`RunUAT.bat` on Windows, `RunUAT.sh` on+macOS/Linux). Drop `-allmaps` and pass `-map=Map1+Map2` to cook a subset.++### 3. Cook only (no packaging), e.g. to refresh content++```bash+RunUAT BuildCookRun -project="C:/Path/MyGame.uproject" -noP4 \+ -platform=Win64 -clientconfig=Development -cook -skipstage+```++## Pitfalls++- **Packaged build loads a black/empty level** — Game Default Map isn't set (or that map wasn't+ cooked). Set it in Maps & Modes and ensure it's included in the cook.+- **Shipping a Development build** — Development keeps logging/console/stats and is slower; ship+ **Shipping**. Conversely, Shipping strips `UE_LOG`/console, so debugging a Shipping-only issue+ needs Development or `Test`.+- **A referenced map/asset is missing at runtime** — it wasn't cooked. Add it to the Packaging+ settings' maps/directories to cook, or cook all maps.+- **Build fails on the platform** — the platform SDK/toolchain isn't installed (Windows build+ tools, Android SDK/NDK, console SDKs). Install the platform's prerequisites.+- **Expecting Blueprint Nativization** — it was **removed in UE5**; don't rely on it for+ performance. Profile and move hot logic to C++ (`unreal-cpp-gameplay`) instead.+- **First cook is very slow** — shaders and all assets cook from scratch; subsequent cooks are+ incremental. Don't mistake a slow first cook for a hang.++## References++- Primary docs: "Packaging Your Project"+ (`https://dev.epicgames.com/documentation/en-us/unreal-engine/packaging-your-project`) and the+ Build Configurations / `BuildCookRun` references.++## Related skills++- `steam-publish` / `itch-publish` — distributing the packaged build to a storefront.+- `unreal-cpp-gameplay` — moving hot logic to C++ now that BP nativization is gone.