unreal-engine-cpp-pro
Développement Mobile & JeuxExpert guide for Unreal Engine 5.x C++ development, covering UObject hygiene, performance patterns, and best practices.
Documentation
Unreal Engine C++ Pro
This skill provides expert-level guidelines for developing with Unreal Engine 5 using C++. It focuses on writing robust, performant, and standard-compliant code.
When to Use
Use this skill when:
Do not use this skill when:
Core Principles
UPROPERTY() for UObject* member variables to ensure they are tracked by the Garbage Collector (GC).TStrongObjectPtr<> if you need to keep a root reference outside of a UObject graph, but prefer addToRoot() generally.IsValid() check vs nullptr. IsValid() handles pending kill state safely.UCLASS(), USTRUCT(), UENUM(), UFUNCTION() to expose types to the reflection system and Blueprints.BlueprintReadWrite when possible; prefer BlueprintReadOnly for state that shouldn't be trampled by logic in UI/Level BPs.bCanEverTick = false) by default. Only enable it if absolutely necessary. Prefer timers (GetWorldTimerManager()) or event-driven logic.Cast() in hot loops. Cache references in BeginPlay.F structs for data-heavy, non-UObject types to reduce overhead.Naming Conventions (Strict)
Follow Epic Games' coding standard:
T (e.g., TArray, TMap).U (e.g., UCharacterMovementComponent).A (e.g., AMyGameMode).S (Slate widgets).F (e.g., FVector).E (e.g., EWeaponState).I (e.g., IInteractable).b (e.g., bIsDead).Common Patterns
1. Robust Component Lookup
Avoid GetComponentByClass in Tick. Do it in PostInitializeComponents or BeginPlay.
void AMyCharacter::PostInitializeComponents() {
Super::PostInitializeComponents();
HealthComp = FindComponentByClass<UHealthComponent>();
check(HealthComp); // Fail hard in dev if missing
}2. Interface Implementation
Use interfaces to decouple systems (e.g., Interaction system).
// Interface call check
if (TargetActor->Implements<UInteractable>()) {
IInteractable::Execute_OnInteract(TargetActor, this);
}3. Async Loading (Soft References)
Avoid hard references (UPROPERTY(EditDefaultsOnly) TSubclassOf) for massive assets which force load orders. Use TSoftClassPtr or TSoftObjectPtr.
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSoftClassPtr<AWeapon> WeaponClassToLoad;
void AMyCharacter::Equip() {
if (WeaponClassToLoad.IsPending()) {
WeaponClassToLoad.LoadSynchronous(); // Or use StreamableManager for async
}
}Debugging
UE_LOG with custom categories.```cpp
DEFINE_LOG_CATEGORY_STATIC(LogMyGame, Log, All);
UE_LOG(LogMyGame, Warning, TEXT("Health is low: %f"), CurrentHealth);
```
```cpp
if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Died!"));
```
IVisualLoggerDebugSnapshotInterface.Checklist before PR
UObject* members wrapped in UPROPERTY?EndPlay?Compétences similaires
Explorez d'autres agents de la catégorie Développement Mobile & Jeux
godot-gdscript-patterns
Master Godot 4 GDScript patterns including signals, scenes, state machines, and optimization. Use when building Godot games, implementing game systems, or learning GDScript best practices.
minecraft-bukkit-pro
Master Minecraft server plugin development with Bukkit, Spigot, and
expo-deployment
"Deploy Expo apps to production"