ue-cpp-fundamentals

Write Unreal Engine C++ classes using UHT reflection macros, UPROPERTY specifiers, and GC-safe ownership patterns.

55|5|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/kevinpbuckley/unreal-engine-skills --skill ue-cpp-fundamentals-kevinpbuckley
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ue-cpp-fundamentals
Source: https://github.com/kevinpbuckley/unreal-engine-skills/tree/main/skills/core/ue-cpp-fundamentals
Command: npx skills add https://github.com/kevinpbuckley/unreal-engine-skills --skill ue-cpp-fundamentals-kevinpbuckley

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Unreal C++ fails to compile, disappears from Blueprints, or crashes after garbage collection when reflection macros, specifiers, or ownership rules are wrong. This Skill provides the exact UCLASS/UPROPERTY/UFUNCTION rules, construction APIs, and pointer types needed to author correct UE C++ the first time. ## Core Features & Use Cases - Reflection macro guidance: Correct usage of UCLASS, USTRUCT, UENUM, UINTERFACE, GENERATED_BODY, the *.generated.h include pipeline, and module API export macros, verified against UE 5.8 engine source. - Specifier reference: Edit/visibility, Blueprint access, replication, and serialization specifiers for UPROPERTY and UFUNCTION, including BlueprintNativeEvent and RPC patterns. - Object construction and ownership: When to use CreateDefaultSubobject vs NewObject vs SpawnActor, how the Class Default Object works, and how to choose between TObjectPtr, raw pointers, TWeakObjectPtr, and TSharedPtr. - Use Case: You are creating a new AActor subclass with Blueprint-exposed health stats and a replicated damage function. The Skill gives you the correct header structure, specifiers, and constructor pattern, and helps you diagnose UHT errors like "missing generated.h" when the build fails. ## Quick Start Ask the agent to create a Blueprintable Unreal C++ Actor class with editable properties and a BlueprintCallable function, following UE 5.8 reflection and ownership rules.

Frequently Asked Questions about ue-cpp-fundamentals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expose a C++ variable to Blueprints in Unreal Engine?

Add UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Group") above the member in your UCLASS header. BlueprintReadWrite allows get and set in Blueprint graphs, while BlueprintReadOnly allows get only. The Category specifier is required for the property to appear in the Details panel.

When should I use NewObject vs CreateDefaultSubobject in Unreal C++?

Use CreateDefaultSubobject only inside constructors to create owned subobjects like components. Use NewObject for runtime creation of any non-Actor UObject, and SpawnActor for Actors. Calling NewObject inside a constructor triggers an assertion in FObjectInitializer.

Why does my Unreal C++ build fail with UHT errors about generated.h?

UHT errors usually mean the ClassName.generated.h include is missing or not the last include in the header, or GENERATED_BODY() is absent from the class. UHT parses headers before compilation, so macro placement mistakes surface as cryptic errors unrelated to the actual cause.

Should I use TObjectPtr or raw pointers for UObject members in UE5?

Use TObjectPtr<T> with UPROPERTY for class members in UE5; it provides editor awareness and access tracking. Raw UType* pointers are fine for local variables and function parameters. Any UObject member not marked UPROPERTY is invisible to garbage collection and can dangle.

Why does my Unreal object get garbage collected unexpectedly?

The object is collected because no UPROPERTY or root-set reference keeps it alive. Store the pointer in a UPROPERTY member, or use FGCObject, AddToRoot, or TStrongObjectPtr for non-UPROPERTY contexts. Plain C++ pointers are invisible to the GC mark phase.

Can a UENUM be used in Blueprints without uint8 backing?

No. A UENUM marked BlueprintType must be backed by uint8, declared as enum class EMyEnum : uint8. Without the uint8 base, the enum cannot be exposed to Blueprint. Use UMETA(DisplayName=...) to customize entry labels in Blueprint dropdowns.