Skilllibrary unreal-engine
Guides Unreal Engine 5 C++ development — UObject reflection system (UCLASS, UPROPERTY, UFUNCTION), AActor lifecycle, Gameplay Framework (GameMode, PlayerController, PlayerState), components, delegates, replication, Enhanced Input, Gameplay Ability System, asset management with soft/hard references, Blueprint-C++ boundary, build system modules, and UE memory model. Use when writing, reviewing, or architecting UE5 C++ code.
install
source · Clone the upstream repo
git clone https://github.com/merceralex397-collab/skilllibrary
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/merceralex397-collab/skilllibrary "$T" && mkdir -p ~/.claude/skills && cp -r "$T/13-game-engines-and-creative-tech/unreal-engine" ~/.claude/skills/merceralex397-collab-skilllibrary-unreal-engine && rm -rf "$T"
manifest:
13-game-engines-and-creative-tech/unreal-engine/SKILL.mdsource content
Purpose
Provide concrete C++ patterns, API usage, and architectural guidance for Unreal Engine 5 projects — covering the UObject system, gameplay framework, replication, GAS, input, asset management, and the Blueprint-C++ boundary.
When to use this skill
- Writing or reviewing C++ classes using
,UCLASS()
,UPROPERTY()
reflection macrosUFUNCTION() - Implementing the AActor lifecycle:
,BeginPlay()
,Tick()
, component initializationEndPlay() - Using the Gameplay Framework: AGameModeBase, AGameStateBase, APlayerState, APlayerController, APawn/ACharacter
- Creating components with
,UActorComponent
,USceneComponentCreateDefaultSubobject<T>(TEXT("Name")) - Setting up delegates:
,DECLARE_DYNAMIC_MULTICAST_DELEGATE
,DECLARE_DELEGATEBindDynamic() - Implementing replication:
,UPROPERTY(Replicated)
,GetLifetimeReplicatedProps()UFUNCTION(Server, Reliable) - Using GAS:
,UGameplayAbility
,UGameplayEffect
,FGameplayTagUAbilitySystemComponent - Configuring Enhanced Input:
,UInputAction
,UInputMappingContext
inBindAction()SetupPlayerInputComponent - Managing assets:
,TSoftObjectPtr<T>
,FSoftObjectPath
, async loadingStreamableManager - Build system:
module rules,.Build.cs
, plugin descriptors, module dependencies.Target.cs
Do not use this skill when
- The task is Blueprint-only with no C++ — use
ue5-blueprint - The project uses Unity or Godot — use
orunitygodot - The task is about narrative design or lore — use
worldbuilding-lore-systems
Operating procedure
- UObject system. Every gameplay class derives from UObject. Use
for Blueprint subclassing. Mark properties withUCLASS(Blueprintable)
for editor/Blueprint access and GC protection. UseUPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Stats")
to expose methods.UFUNCTION(BlueprintCallable) - Actor lifecycle. Constructor for
and defaults only — no gameplay logic.CreateDefaultSubobject
for initialization.BeginPlay()
for per-frame updates (disable withTick()
).PrimaryActorTick.bCanEverTick = false
for cleanup.EndPlay() - Gameplay Framework. GameMode owns match rules (server-only). GameState holds replicated match data. PlayerState holds per-player replicated data. PlayerController handles input and UI. Pawn/Character is the physical avatar. Understand which classes exist on server, client, or both.
- Components. Create in constructor:
. Set root withUStaticMeshComponent* Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"))
. Attach children withSetRootComponent(Mesh)
.SetupAttachment(RootComponent) - Delegates.
for Blueprint-compatible events. Bind withDECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnHealthChanged, float, NewHealth)
. Use non-dynamic delegates for C++-only, higher-performance events.OnHealthChanged.AddDynamic(this, &AMyActor::HandleHealthChanged) - Replication. Mark replicated properties:
. ImplementUPROPERTY(ReplicatedUsing=OnRep_Health)
withGetLifetimeReplicatedProps
. Server RPCs:DOREPLIFETIME(AMyActor, Health)
. Client RPCs:UFUNCTION(Server, Reliable)
. Multicast:UFUNCTION(Client, Reliable)
.UFUNCTION(NetMulticast, Unreliable) - Enhanced Input. Create
andUInputAction
assets. InUInputMappingContext
, cast toSetupPlayerInputComponent
, callUEnhancedInputComponent
. Add mapping context viaBindAction(InputAction, ETriggerEvent::Triggered, this, &AMyChar::Move)
.UEnhancedInputLocalPlayerSubsystem - GAS. Add
to character. Define abilities asUAbilitySystemComponent
subclasses. Apply effects viaUGameplayAbility
. Tag everything withUGameplayEffect
. Grant abilities withFGameplayTag
. Activate withGiveAbility(FGameplayAbilitySpec)
.TryActivateAbilityByClass - Asset management. Use
for lazy loading. Resolve withTSoftObjectPtr<UStaticMesh>
or async viaLoadSynchronous()
. Hard references (FStreamableManager::RequestAsyncLoad
UPROPERTY) force load — use only for always-needed assets.UStaticMesh* - Blueprint-C++ boundary.
— C++ implements, Blueprint calls.BlueprintCallable
— Blueprint implements, C++ calls.BlueprintImplementableEvent
— C++ provides default, Blueprint can override viaBlueprintNativeEvent
._Implementation - Build system.
declares module dependencies (.Build.cs
).PublicDependencyModuleNames.Add("EnhancedInput")
configures build target. Organize into modules: core gameplay, UI, networking. Plugins get.Target.cs
descriptors..uplugin - Memory.
prevents GC of UObject pointers. For non-UObject shared ownership useUPROPERTY()
/TSharedPtr<T>
. UseTWeakPtr<T>
for exclusive ownership. Never use rawTUniquePtr<T>
/new
on UObjects — usedelete
and let GC handle destruction.NewObject<T>()
Decision rules
- Every
member must beUObject*
or it will be garbage collected unexpectedly.UPROPERTY() - Disable Tick on actors that don't need per-frame updates — use timers or event-driven updates instead.
- GameMode exists only on the server — never access it from client code directly.
- Use
for any asset over 1MB that isn't needed at spawn time.TSoftObjectPtr - Prefer
overBlueprintNativeEvent
when C++ needs a default implementation.BlueprintImplementableEvent - All replicated properties need
— forgetting this is the #1 replication bug.GetLifetimeReplicatedProps
Output requirements
— class declaration with UCLASS, UPROPERTY, UFUNCTION macros, includes, forward declarationsHeader (.h)
— implementation with constructor, lifecycle, and gameplay logicSource (.cpp)
— any new module dependencies requiredBuild.cs Changes
— which properties replicate, which RPCs are needed, authority modelReplication Notes
— which functions/properties are Blueprint-accessible and whyBlueprint Exposure
References
- UE5 Programming Guide
- Gameplay Framework
- Networking and Multiplayer
- Gameplay Ability System
- Enhanced Input
- UE5 API Reference
Related skills
— Blueprint visual scripting side of the C++ boundaryue5-blueprint
— reusable Blueprint architecture patternsblueprint-patterns
— advanced networking beyond basic replicationmultiplayer-netcode
— higher-level game system designgame-design-systems
Failure handling
- If a
pointer is null at runtime, check thatUPROPERTY
is in the constructor and the property is initialized.CreateDefaultSubobject - If replication doesn't work, verify
on the actor,bReplicates = true
includes the property, and the actor has authority.GetLifetimeReplicatedProps - If Enhanced Input doesn't fire, confirm the mapping context was added to the local player subsystem and the input action asset is assigned.
- If GAS abilities fail to activate, check that the AbilitySystemComponent is initialized on
/PossessedBy
and abilities are granted.OnRep_PlayerState