ue-cpp-foundations

Use when writing Unreal Engine C++ code involving UPROPERTY, UFUNCTION, UCLASS, TArray, TMap, delegates, FString, garbage collection, or smart pointers. Also use when the user asks about "UE C++", USTRUCT, UENUM, FName, FText, TObjectPtr, TWeakObjectPtr, UObject lifetime, UE_LOG, or UE subsystems. F

By quodsoler · 973 installs

npx skills add quodsoler/unreal-engine-skills --skill ue-cpp-foundations

Source repository · Upstream listing

UE C++ Foundations You are an expert in Unreal Engine's C++ extensions and property system. Context Read .agents/ue project context.md for engine version, coding conventions, and project specific rules. Engine version matters: UE5 uses TObjectPtr< where UE4 used raw UObject , and GENERATED BODY() replaces GENERATED USTRUCT BODY() in structs. Before You Start Ask which area the user needs help with if unclear: Macros & Reflection — UCLASS, UPROPERTY, UFUNCTION, USTRUCT, UENUM Containers — TArray, TMap, TSet, TOptional Delegates — static, dynamic, multicast, binding patterns Strings — FName, FString, FText conversion and formatting Memory & GC — TObjectPtr, TWeakObjectPtr, TSharedPtr, GC roots Logging — UE LOG, log categories, verbosity Subsystems — GameInstance, World, LocalPlayer subsystems UObject Macros & Reflection All UE reflection macros require GENERATED BODY() inside the class/struct and the corresponding .generated.h include. UCLASS() Specifier Effect Blueprintable Blueprint subclassing allowed BlueprintType Usable as Blueprint variable Abstract Cannot be instantiated NotBlueprintable Blocks Blueprint subclassing Config=<Name Loads UPROPERTY(Config) from <Name .ini Transient Not saved/serialized Within=<OuterClass Outer must be of given type Full specifier list: [references/property specifiers.md](references/property specifiers.md). UPROPERTY() UFUNCTION() USTRUCT() and UENUM() UE Containers See [references/container patterns.md](references/container patterns.md) for full API and performance guide. TArray — Ordered Dynamic Array TMap — Hash Map TSet — Hash Set TOptional TVariant Delegates See [references/delegate patterns.md](references/delegate patterns.md) for all declaration macros and binding methods. Choosing the Right Type Type Bindings Blueprint When to Use DECLARE DELEGATE 1 No Internal single owner callback DECLARE MULTICAST DELEGATE N No Internal multi listener events DECLARE DYNAMIC DELEGATE 1 Yes Blueprint assignable single callback DECLARE DYNAMIC MULTICAST DELEGATE N Yes Blueprint bindable events (most common) Declaration, Binding, Invocation String Types Type Use For Comparison Mutable FName Identifiers, asset names, tags O(1) integer No FString General purpose strings, file paths O(n) Yes FText Player visible display strings — No Conversion: Name.ToString() → FString, FName( Str) ← FString, FText::FromString(Str) , Text.ToString() . Memory & Garbage Collection UE's GC tracks every UObject reachable from a root. Unreachable objects are destroyed. Logging Verbosity Visible When Fatal Always Crash level Error Always Operation failed Warning Always Unexpected but recoverable Log Non shipping Standard trace Verbose LogCmds Fine grained trace Subsystems Auto registered singletons — no manual AddToRoot needed. Subsystem Owner Persists Level Load Per Player UGameInstanceSubsystem UGameInstance Yes No UWorldSubsystem UWorld No No ULocalPlayerSubsystem ULocalPlayer Yes Yes UEngineSubsystem UEngine Yes (whole session) No Subsystems have Initialize() and Deinitialize() override for setup/teardown. UGameInstanceSubsystem persists across map changes; UWorldSubsystem reinitializes per world. Call GetSubsystem<T () via the owning context ( GetGameInstance() , GetWorld() , GetLocalPlayer() ). Replicated Properties Both UPROPERTY specifier AND GetLifetimeReplicatedProps are required: Conditional Compilation Guards Common Mistakes Raw UObject member without UPROPERTY — dangling pointer: Modify TArray during ranged for — undefined behavior: TSharedPtr on a UObject — GC + refcount conflict: Missing GetLifetimeReplicatedProps: GENERATED USTRUCT BODY() in UE5 structs — use GENERATED BODY() instead. AddDynamic with a non UFUNCTION — compile error or crash at runtime. Related Skills ue module build system — Build.cs, module dependencies, include paths, PCH configuration ue actor component architecture — AActor/UActorComponent lifecycle, spawning, tick groups, component setup