{ }Blueprint → C++
Unreal Engine 5 · the C++ behind every Blueprint node

Blueprint nodes, translated to C++.

A fast, searchable cheatsheet of 190 essential Unreal Engine 5 blueprint nodes and their C++ equivalents. Search, copy, ship.

190
Nodes
19
Categories

Core set by Marco Henning (MIT); additional nodes authored from the Unreal Engine documentation. Presented by Göktuğ Ülvan (Gus).

Basics8

Cast To

Cast To blueprint node
C++
AActor* ExampleActor;

// Casting: <> = Type to cast to, () = Object to cast
ACharacter* ExampleCharacter = Cast<ACharacter>(ExampleActor);

if (ExampleCharacter)
{
	// Cast Succeeded...
}
else
{
	// Cast Failed...
}
Open full page & explanation →

AActor17

Set Actor Transform

Set Actor Transform blueprint node
C++
AActor* ExampleActor;

FVector NewLocation;
FRotator NewRotation;
FVector NewScale3D;

// Create FTransform (rotation, location and scale)
FTransform NewTransform(NewRotation, NewLocation, NewScale3D);

ExampleActor->SetActorTransform(NewTransform);
Open full page & explanation →

Components12

Play Animation

Play Animation blueprint node
.h File
private:
	// The animation asset needs to be set in blueprint
	UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"))
	class UAnimationAsset* ExampleAnimation;
.cpp File
USkeletalMeshComponent* ExampleComponent;

if (ExampleAnimation)
{
	ExampleComponent->PlayAnimation(
		ExampleAnimation,         // Animation asset
		false                     // Loop animation?
	);
}
Open full page & explanation →

AGameModeBase2

Event OnPostLogin

Event OnPostLogin blueprint node
.h File
public:
	// This method gets called every time a user logs in
	virtual void PostLogin(APlayerController* NewPlayer) override;
.cpp File
void ExampleGameMode::PostLogin(APlayerController* NewPlayer)
{
	Super::PostLogin(NewPlayer);

	// Your code here...
}
Open full page & explanation →

Event OnLogout

Event OnLogout blueprint node
.h File
public:
	// This method gets called every time a user logs out
	virtual void Logout(AController* Exiting) override;
.cpp File
void ExampleGameMode::Logout(AController* Exiting)
{
	// Your code here...
}
Open full page & explanation →

User Interface9

Create Widget

Create Widget blueprint node
.h File
private:
	// The specific user widget needs to be set in blueprint
	UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"))
	TSubclassOf<UUserWidget> ExampleWidgetClass;
.cpp File
#include "Blueprint/UserWidget.h"

if (ExampleWidgetClass)
{
	// Create widget
	UUserWidget* ExampleWidget = CreateWidget<UUserWidget>(GetWorld(), ExampleWidgetClass);
}
Open full page & explanation →

Set Input Mode Game Only

Set Input Mode Game Only blueprint node
C++
#include "Kismet/GameplayStatics.h"

// Get player controller
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);

if (PlayerController)
{
	// Set input mode
	FInputModeGameOnly InputMode;
	PlayerController->SetInputMode(InputMode);
}
Open full page & explanation →

Set Input Mode UI Only

Set Input Mode UI Only blueprint node
C++
#include "Kismet/GameplayStatics.h"

// Get player controller
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);

if (PlayerController)
{
	// Set input mode
	FInputModeUIOnly InputMode;
	PlayerController->SetInputMode(InputMode);
}
Open full page & explanation →

Set Input Mode Game and UI

Set Input Mode Game and UI blueprint node
C++
#include "Kismet/GameplayStatics.h"

// Get player controller
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);

if (PlayerController)
{
	// Set input mode
	FInputModeGameAndUI InputMode;
	PlayerController->SetInputMode(InputMode);
}
Open full page & explanation →

Timer3

Set Timer by Function Name

Set Timer by Function Name blueprint node
C++
#include "TimerManager.h"

FTimerHandle TimerHandle;

GetWorldTimerManager().SetTimer(
	TimerHandle,                          // Timer handle
	this,                                 // Object to call the timer function on
	&AExampleCharacter::ExampleMethod,    // Method to call the timer function on
	3.0f,                                 // Delay (in seconds)
	false                                 // Loop timer?
);
Open full page & explanation →

Math41

Utilities31

Print String

Print String blueprint node
C++
if (GEngine)
{
	GEngine->AddOnScreenDebugMessage(
		-1,                        // Key
		2.0f,                      // Duration
		FColor::Cyan,              // Color
		"Hello"                    // Message
	);
}
C++
#include "Kismet/KismetSystemLibrary.h"

UKismetSystemLibrary::PrintString(
	this,                                    // World context object
	"Hello",                                 // Message
	true,                                    // Print to screen?
	true,                                    // Print to console?
	FLinearColor(0.0f, 0.66f, 1.0f, 1.0f),   // Color
	2.0f                                     // Duration
);
Open full page & explanation →

Spawn Emitter at Location

Spawn Emitter at Location blueprint node
.h File
private:
	// The emitter needs to be set in blueprint
	UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"))
	UParticleSystem* ExampleEmitter;
.cpp File
#include "Kismet/GameplayStatics.h"

UParticleSystemComponent* SpawnedEmitter;
FTransform SpawnTransform;

if (ExampleEmitter)
{
	SpawnedEmitter = UGameplayStatics::SpawnEmitterAtLocation(
		GetWorld(),        // World object
		ExampleEmitter,    // Emitter
		SpawnTransform     // Spawn transform
	);
}
Open full page & explanation →

Line Trace By Channel

Line Trace By Channel blueprint node
C++
FVector Start;
FVector End;

// Results will be stored here
FHitResult HitResult;

bool bHit = GetWorld()->LineTraceSingleByChannel(
	HitResult,                                   // Hit result
	Start,                                       // Start of the trace
	End,                                         // End of the trace
	ECollisionChannel::ECC_Visibility            // Trace channel
);
Open full page & explanation →

Multi Line Trace By Channel

Multi Line Trace By Channel blueprint node
C++
FVector Start;
FVector End;

// Results will be stored here
TArray<FHitResult> HitResults;

bool bHit = GetWorld()->LineTraceMultiByChannel(
	HitResults,                                  // Hit results
	Start,                                       // Start of the trace
	End,                                         // End of the trace
	ECollisionChannel::ECC_Visibility            // Trace channel
);
Open full page & explanation →

Get Actor Of Class

Get Actor Of Class blueprint node
.h File
private:
	// The class needs to be set in blueprint
	UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"))
	TSubclassOf<AActor> ActorClass;
.cpp File
#include "Kismet/GameplayStatics.h"

// First found actor
AActor* Actor;

if (ActorClass)
{
	Actor = UGameplayStatics::GetActorOfClass(
		this,                               // World context object
		ActorClass                          // Actor class
	);
}
Open full page & explanation →

Get All Actors Of Class

Get All Actors Of Class blueprint node
.h File
private:
	// The class needs to be set in blueprint
	UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"))
	TSubclassOf<AActor> ActorClass;
.cpp File
#include "Kismet/GameplayStatics.h"

// Result will be stored here
TArray<AActor*> Actors;

if (ActorClass)
{
	UGameplayStatics::GetAllActorsOfClass(
		this,                           // World context object
		ActorClass,                     // Actor class
		Actors                          // (Output) Result
	);
}
Open full page & explanation →

Get All Actors with Tag

Get All Actors with Tag blueprint node
C++
#include "Kismet/GameplayStatics.h"

// Result will be stored in this array
TArray<AActor*> Actors;

UGameplayStatics::GetAllActorsWithTag(
	this,                           // World context object
	"ExampleTag",                   // Tag name
	Actors                          // (Output) Result
);
Open full page & explanation →

Spawn Actor from Class

Spawn Actor from Class blueprint node
.h File
private:
	// The actor class needs to be set in blueprint
	UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"))
	TSubclassOf<AActor> ActorClass;
.cpp File
AActor* SpawnedActor;
FVector Location;
FRotator Rotation;
FActorSpawnParameters SpawnParameters;

if (ActorClass)
{
	SpawnedActor = GetWorld()->SpawnActor<AActor>(
		ActorClass,               // Actor class
		Location,                 // Spawn location
		Rotation,                 // Spawn rotation
		SpawnParameters           // Spawn parameters
	);
}
Open full page & explanation →

Play Sound 2D

Play Sound 2D blueprint node
.h File
private:
	// The sound needs to be set in blueprint
	UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"))
	USoundBase* ExampleSound;
.cpp File
#include "Kismet/GameplayStatics.h"

if (ExampleSound)
{
	UGameplayStatics::PlaySound2D(
		this,                   // World context object
		ExampleSound,           // Sound
		1.0f,                   // Volume multiplier
		1.0f                    // Pitch multiplier
	);
}
Open full page & explanation →

Play Sound at Location

Play Sound at Location blueprint node
.h File
private:
	// The sound needs to be set in blueprint
	UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"))
	USoundBase* ExampleSound;
.cpp File
#include "Kismet/GameplayStatics.h"

FVector Location;

if (ExampleSound)
{
	UGameplayStatics::PlaySoundAtLocation(
		this,                           // World context object
		ExampleSound,                   // Sound
		Location,                       // Location
		1.0f,                           // Volume multiplier
		1.0f                            // Pitch multiplier
	);
}
Open full page & explanation →

Apply Damage

Apply Damage blueprint node
C++
#include "Kismet/GameplayStatics.h"

AController* EventInstigator;
AActor* DamagedActor;
AActor* DamageCauser;

UGameplayStatics::ApplyDamage(
	DamagedActor,                  // Damaged actor
	100.0f,                        // Damage amount
	EventInstigator,               // Instigator
	DamageCauser,                  // Damage causer
	UDamageType::StaticClass()     // Damage type
);
Open full page & explanation →

Apply Radial Damage

Apply Radial Damage blueprint node
C++
#include "Kismet/GameplayStatics.h"

FVector Origin;
AActor* DamageCauser;
AController* EventInstigator;

UGameplayStatics::ApplyRadialDamage(
	this,                          // World context object
	100.0f,                        // Damage amount
	Origin,                        // Damage location
	200.0f,                        // Damage radius
	UDamageType::StaticClass(),    // Damage type
	TArray<AActor*>(),             // Ignored actors
	DamageCauser,                  // Damage causer
	EventInstigator,               // Instigator
	false                          // Do full damage?
);
Open full page & explanation →

Project World to Screen

Project World to Screen blueprint node
C++
#include "Kismet/GameplayStatics.h"

// Get player controller
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);

FVector WorldPosition;

// Result is stored in this vector
FVector2D ScreenPosition;

UGameplayStatics::ProjectWorldToScreen(
	PlayerController,                  // Target player
	WorldPosition,                     // World position
	ScreenPosition,                    // (Output) Screen position
	false                              // Player viewport relative?
);
Open full page & explanation →

Deproject Screen to World

Deproject Screen to World blueprint node
C++
#include "Kismet/GameplayStatics.h"

// Get player controller
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);

FVector2D ScreenPosition;

// Result is stored in these vectors
FVector WorldPosition;
FVector WorldDirection;

UGameplayStatics::DeprojectScreenToWorld(
	PlayerController,                  // Target player
	ScreenPosition,                    // Screen position
	WorldPosition,                     // (Output) World position
	WorldDirection                     // (Output) World direction
);
Open full page & explanation →

Spawn Decal at Location

Spawn Decal at Location blueprint node
.h File
private:
	// The material needs to be set in blueprint
	UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"))
	UMaterialInterface* ExampleMaterial;
.cpp File
#include "Kismet/GameplayStatics.h"

UDecalComponent* SpawnedDecal;
FVector Size;
FVector Location;
FRotator Rotation;

if (ExampleMaterial)
{
	SpawnedDecal = UGameplayStatics::SpawnDecalAtLocation(
		this,                 // World context object
		ExampleMaterial,      // Decal material
		Size,                 // Decal size
		Location,             // Decal location
		Rotation,             // Decal rotation
		0.0f                  // Life span (0 = infinite)
	);
}
Open full page & explanation →

Draw Debug Line

Draw Debug Line blueprint node
C++
FVector Start;
FVector End;

DrawDebugLine(
	GetWorld(),        // World object
	Start,             // Start of the line
	End,               // End of the line
	FColor::Red,       // Line color
	false,             // Persistent?
	5.0f,              // Duration
	0,                 // Depth priority
	1.0f               // Line thickness
);
Open full page & explanation →

Draw Debug Box

Draw Debug Box blueprint node
C++
FVector Center;
FVector Extent;

DrawDebugBox(
	GetWorld(),        // World object
	Center,            // Box center
	Extent,            // Box extent
	FColor::Red,       // Box color
	false,             // Persistent?
	5.0f,              // Duration
	0,                 // Depth priority
	1.0f               // Line thickness
);
Open full page & explanation →

Is Valid

Is Valid blueprint node
C++
AActor* ExampleActor;

// Check validity
if (ExampleActor)
{
	// Is Valid...
}
else
{
	// Is Not Valid...
}
C++
#include "Kismet/KismetSystemLibrary.h"

AActor* ExampleActor;

// Check validity
if (UKismetSystemLibrary::IsValid(ExampleActor))
{
	// Is Valid...
}
else
{
	// Is Not Valid...
}
Open full page & explanation →

Quit Game

Quit Game blueprint node
C++
#include "Kismet/GameplayStatics.h"
#include "Kismet/KismetSystemLibrary.h"

// Get player controller
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);

// Quit game
UKismetSystemLibrary::QuitGame(
	this,                        // World context object
	PlayerController,            // Quitting player controller
	EQuitPreference::Quit,       // Quit preference
	false                        // Ignore platform restrictions?
);
Open full page & explanation →

Sphere Trace By ChannelUE Docs

C++
#include "Kismet/KismetSystemLibrary.h"

FHitResult Hit;
bool bHit = UKismetSystemLibrary::SphereTraceSingle(
  this, Start, End, /*Radius=*/50.f,
  UEngineTypes::ConvertToTraceType(ECC_Visibility), false, {},
  EDrawDebugTrace::ForDuration, Hit, true);
Open full page & explanation →

Input (Enhanced Input)4

Add Input Mapping ContextUE Docs

Header (.h)
UPROPERTY(EditAnywhere, Category="Input")
UInputMappingContext* DefaultMappingContext;
BeginPlay (.cpp)
#include "EnhancedInputSubsystems.h"

if (APlayerController* PC = Cast<APlayerController>(GetController()))
{
  if (UEnhancedInputLocalPlayerSubsystem* Subsystem =
      ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PC->GetLocalPlayer()))
  {
    Subsystem->AddMappingContext(DefaultMappingContext, /*Priority=*/0);
  }
}
Open full page & explanation →

Bind Input ActionUE Docs

Header (.h)
UPROPERTY(EditAnywhere, Category="Input")
UInputAction* MoveAction;

void Move(const FInputActionValue& Value);
SetupPlayerInputComponent (.cpp)
#include "EnhancedInputComponent.h"

void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
  Super::SetupPlayerInputComponent(PlayerInputComponent);

  if (UEnhancedInputComponent* Input = Cast<UEnhancedInputComponent>(PlayerInputComponent))
  {
    Input->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AMyCharacter::Move);
  }
}
Open full page & explanation →

Read Input Action ValueUE Docs

C++
#include "InputActionValue.h"

void AMyCharacter::Move(const FInputActionValue& Value)
{
  // Pick the type that matches the Input Action's Value Type:
  FVector2D Axis2D = Value.Get<FVector2D>();   // Axis2D
  float Axis1D     = Value.Get<float>();        // Axis1D
  bool bPressed    = Value.Get<bool>();         // Digital (bool)
}
Open full page & explanation →

Trigger Events (Started / Triggered / Completed)UE Docs

C++
// ETriggerEvent values you bind against:
//   ETriggerEvent::Started    -> press / key down
//   ETriggerEvent::Triggered  -> while held / fires each tick
//   ETriggerEvent::Completed  -> release / key up
Input->BindAction(JumpAction, ETriggerEvent::Started,   this, &AMyCharacter::StartJump);
Input->BindAction(JumpAction, ETriggerEvent::Completed, this, &AMyCharacter::StopJump);
Open full page & explanation →

Collision & Overlap8

Event On Component Begin OverlapUE Docs

Header (.h)
UFUNCTION()
void OnBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
  UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
  const FHitResult& SweepResult);
Bind it (constructor / BeginPlay)
MyCollision->OnComponentBeginOverlap.AddDynamic(this, &AMyActor::OnBeginOverlap);
Open full page & explanation →

Event On Component End OverlapUE Docs

Header (.h)
UFUNCTION()
void OnEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
  UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
Bind it
MyCollision->OnComponentEndOverlap.AddDynamic(this, &AMyActor::OnEndOverlap);
Open full page & explanation →

Event On HitUE Docs

Header (.h)
UFUNCTION()
void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor,
  UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
Bind it (needs Simulate Physics + Notify Rigid Body Collision)
MyMesh->SetNotifyRigidBodyCollision(true);
MyMesh->OnComponentHit.AddDynamic(this, &AMyActor::OnHit);
Open full page & explanation →

Events & Dispatchers6

Blueprint Native EventUE Docs

C++
// .h — default C++ body, overridable in Blueprint
UFUNCTION(BlueprintNativeEvent, Category="Gameplay")
void OnScored(int32 Points);

// .cpp — note the _Implementation suffix
void AMyActor::OnScored_Implementation(int32 Points) { /* default */ }
Open full page & explanation →

Character & Pawn9

Get Control RotationUE Docs

C++
FRotator ControlRot = GetControlRotation();
// Yaw-only forward (common for movement):
FRotator YawRot(0.f, ControlRot.Yaw, 0.f);
FVector Forward = FRotationMatrix(YawRot).GetUnitAxis(EAxis::X);
Open full page & explanation →

Flow Control7

MultiGateUE Docs

C++
// .h
int32 GateIndex = 0;

// .cpp — route to the next output each call
switch (GateIndex++ % 3)
{
  case 0: OutputA(); break;
  case 1: OutputB(); break;
  case 2: OutputC(); break;
}
Open full page & explanation →

Strings, Text & Names6

Arrays & Containers8

Map (TMap)UE Docs

C++
TMap<FString, int32> Scores;
Scores.Add(TEXT("P1"), 10);
if (int32* Found = Scores.Find(TEXT("P1"))) { int32 V = *Found; }
bool bHas = Scores.Contains(TEXT("P1"));
Open full page & explanation →

Physics5

Save & Load5

Interfaces3

Declare Blueprint InterfaceUE Docs

C++
// MyInterface.h
UINTERFACE(MinimalAPI, Blueprintable)
class UMyInterface : public UInterface { GENERATED_BODY() };

class IMyInterface
{
  GENERATED_BODY()
public:
  UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category="Interface")
  void Interact();
};
Open full page & explanation →

Implement InterfaceUE Docs

C++
// .h
class AMyActor : public AActor, public IMyInterface
{
  GENERATED_BODY()
  virtual void Interact_Implementation() override;
};

// .cpp
void AMyActor::Interact_Implementation() { /* ... */ }
Open full page & explanation →

Networking & Replication6

Replicated VariableUE Docs

C++
// .h
UPROPERTY(Replicated)
int32 Health;

// .cpp
#include "Net/UnrealNetwork.h"
void AMyActor::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& Out) const
{
  Super::GetLifetimeReplicatedProps(Out);
  DOREPLIFETIME(AMyActor, Health);
}
// constructor: bReplicates = true;
Open full page & explanation →