{ }Blueprint → C++
Unreal Engine 5 · for devs moving from Blueprints to C++

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 →

How to convert Blueprint to C++ in Unreal Engine 5

There is no single button that exports a Blueprint graph to C++ in Unreal Engine 5, so the practical path is to recreate each node's behavior in code. This cheatsheet maps 190 common Blueprint nodes to their C++ equivalents across 19 categories, so you can look up a node like Event BeginPlay, Set Actor Location, or Line Trace By Channel and copy the matching .h and .cpp code.

Most events become overridable functions: the BeginPlay node maps to void BeginPlay() override; in the header and Super::BeginPlay(); in the source, while the Event Tick node maps to void Tick(float DeltaTime) override;. Working node by node lets you port an existing Blueprint to C++ without missing the setup, includes, and class macros that the visual graph handles for you automatically.

Should you use Blueprint or C++ in Unreal Engine 5?

C++ is compiled to native machine code, so it runs faster than Blueprints for heavy logic, large loops, and per-frame work, and it gives you full access to the engine's API and source. Blueprints are interpreted by a virtual machine and are slower for intensive operations, but they are excellent for fast prototyping, designer-friendly tweaks, and visual logic that is quick to read and iterate on.

Most professional teams mix both rather than choosing one. A common pattern is to write core systems and performance-critical code in C++, expose it to designers with UFUNCTION(BlueprintCallable) and UPROPERTY(EditAnywhere, BlueprintReadWrite), then build and tune gameplay in Blueprint child classes on top of that C++ base.

Learn Unreal Engine 5 C++ by starting from the Blueprints you know

If you already think in Blueprint nodes, the fastest way to learn Unreal C++ is to translate concepts you understand instead of starting from raw syntax. Each entry here shows the original Blueprint node, the exact .h and .cpp code it corresponds to, and a short explanation of the macros, includes, and engine types involved, so the jump from visual scripting to text is concrete rather than abstract.

The categories follow how Unreal is actually used, including Basics, AActor, Components, Math, Utilities, Collision and Overlap, Character and Pawn, Enhanced Input, Networking and Replication, Save and Load, and Interfaces. Searching a familiar node name surfaces the C++ you need, which makes the reference useful both while learning and as a day-to-day lookup.

Frequently asked questions

Is the UE5 Blueprint to C++ cheatsheet free?+

Yes. The cheatsheet is completely free to use, with no account or sign-up required, and every node page is openly accessible and searchable.

Do I need to know C++ already to use it?+

No. The reference is aimed at developers coming from Blueprint, so it shows the original node next to the code; basic C++ familiarity helps you adapt the snippets, but each entry explains the includes, macros, and engine types involved.

Can I mix Blueprint and C++ in Unreal Engine 5?+

Yes, and it is the standard approach. You typically write systems in C++ and expose them to Blueprint with macros like UFUNCTION(BlueprintCallable) and UPROPERTY(BlueprintReadWrite), then create Blueprint child classes that build on that C++ base.

Is C++ faster than Blueprint in Unreal Engine?+

For heavy logic it usually is, because C++ compiles to native code while Blueprints run on an interpreted virtual machine. The difference is largest in tight loops and per-frame work; for light, event-driven logic the gap is often negligible.

Which Unreal Engine version does this cheatsheet target?+

It targets Unreal Engine 5, including current UE5 APIs such as Enhanced Input. Much of the C++ also applies to earlier engine versions, but some nodes and types are UE5-specific.

Where does the cheatsheet content come from?+

The core node set is by Marco Henning and is MIT licensed, while additional nodes were authored from the official Unreal Engine documentation. The site is presented by Göktuğ Ülvan.

How do I use the cheatsheet?+

Search or browse by category for the Blueprint node you want, open its page, and read the node, the .h and .cpp code, and the explanation. Then copy the snippet into your own class and adjust the names and parameters to fit your project.

Do I still need Blueprints if I learn C++?+

Usually yes. Even C++-heavy projects rely on Blueprints for content like UMG widgets, animation graphs, level scripting, and designer-facing tuning, so the two are complementary rather than mutually exclusive.