Loading...
Loading...
Expert guide for Unreal Engine 5.x C++ development, covering UObject hygiene, performance patterns, and best practices.
npx skill4agent add sickn33/antigravity-awesome-skills unreal-engine-cpp-proUPROPERTY()UObject*TStrongObjectPtr<>addToRoot()IsValid()nullptrIsValid()UCLASS()USTRUCT()UENUM()UFUNCTION()BlueprintReadWriteBlueprintReadOnlybCanEverTick = falseGetWorldTimerManager()Cast<T>()BeginPlayFTTArrayTMapUUCharacterMovementComponentAAMyGameModeSFFVectorEEWeaponStateIIInteractablebbIsDeadGetComponentByClassTickPostInitializeComponentsBeginPlayvoid AMyCharacter::PostInitializeComponents() {
Super::PostInitializeComponents();
HealthComp = FindComponentByClass<UHealthComponent>();
check(HealthComp); // Fail hard in dev if missing
}// Interface call check
if (TargetActor->Implements<UInteractable>()) {
IInteractable::Execute_OnInteract(TargetActor, this);
}UPROPERTY(EditDefaultsOnly) TSubclassOf<AActor>TSoftClassPtrTSoftObjectPtrUPROPERTY(EditAnywhere, BlueprintReadWrite)
TSoftClassPtr<AWeapon> WeaponClassToLoad;
void AMyCharacter::Equip() {
if (WeaponClassToLoad.IsPending()) {
WeaponClassToLoad.LoadSynchronous(); // Or use StreamableManager for async
}
}UE_LOGDEFINE_LOG_CATEGORY_STATIC(LogMyGame, Log, All);
UE_LOG(LogMyGame, Warning, TEXT("Health is low: %f"), CurrentHealth);if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Died!"));IVisualLoggerDebugSnapshotInterfaceUObject*UPROPERTYEndPlay