Learn Unreal-engine - 10 Code Examples & CST Typing Practice Test
Unreal Engine is a high-end, real-time 3D creation platform developed by Epic Games, used for building AAA games, cinematic experiences, virtual production, simulations, architecture visualization, and interactive applications with photorealistic graphics.
View all 10 Unreal-engine code examples →
Learn UNREAL-ENGINE with Real Code Examples
Updated Nov 24, 2025
Code Sample Descriptions
Unreal Engine Simple 3D Todo Prototype
// Blueprint: TodoTask Actor
// Add a Static Mesh for task representation
// Add OnClicked event to mark task complete
// Optional C++ component for managing task list
/* C++ Example: TodoTask.cpp */
#include "TodoTask.h"
#include "Engine/Engine.h"
void ATodoTask::OnClicked() {
UE_LOG(LogTemp, Warning, TEXT("Task completed: %s"), *TaskName);
}
Demonstrates a simple Unreal Engine prototype simulating tasks in a 3D environment using Blueprints for visual scripting and optional C++ logic.
Unreal Engine Basic Player Movement
// Blueprint: Player Character
// Add Input Axis for MoveForward and MoveRight
// Use AddMovementInput node for Blueprint
/* C++ Example: MyCharacter.cpp */
#include "MyCharacter.h"
void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) {
PlayerInputComponent->BindAxis("MoveForward", this, &AMyCharacter::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &AMyCharacter::MoveRight);
}
void AMyCharacter::MoveForward(float Value) { AddMovementInput(GetActorForwardVector(), Value); }
void AMyCharacter::MoveRight(float Value) { AddMovementInput(GetActorRightVector(), Value); }
Shows simple player movement using Blueprints with optional C++ logic for handling input.
Unreal Engine Object Spawner
// Blueprint: ObjectSpawner Actor
// Add Input Action (SpawnObject)
// Use SpawnActor node to create Blueprint Class
/* C++ Example: ObjectSpawner.cpp */
#include "ObjectSpawner.h"
#include "Kismet/GameplayStatics.h"
void AObjectSpawner::SpawnItem() {
if (SpawnClass) {
FVector Location = GetActorLocation() + FVector(0,0,100);
GetWorld()->SpawnActor<AActor>(SpawnClass, Location, FRotator::ZeroRotator);
}
}
Spawns actors dynamically in the level when pressing a key, demonstrated via Blueprint and C++.
Unreal Engine Collectible Coins
// Blueprint: Coin Actor
// Add Sphere Collision and OnBeginOverlap event
// Call IncreaseScore on overlap
/* C++ Example: Coin.cpp */
#include "Coin.h"
#include "GameFramework/Actor.h"
#include "MyGameMode.h"
void ACoin::NotifyActorBeginOverlap(AActor* Other) {
if (AMyGameMode* GM = Cast<AMyGameMode>(GetWorld()->GetAuthGameMode())) {
GM->AddScore(1);
Destroy();
}
}
Implements collectible coins with Blueprints and score tracking logic in C++.
Unreal Engine Basic Timer Blueprint
// Blueprint: TimerActor
// Use SetTimer by Event node with custom function 'TickTimer'
/* C++ Example: TimerActor.cpp */
#include "TimerActor.h"
#include "Engine/Engine.h"
void ATimerActor::BeginPlay() {
Super::BeginPlay();
GetWorldTimerManager().SetTimer(TimerHandle, this, &ATimerActor::TickTimer, 1.0f, true);
}
void ATimerActor::TickTimer() {
TimeRemaining--;
UE_LOG(LogTemp, Warning, TEXT("Time Remaining: %d"), TimeRemaining);
if (TimeRemaining <= 0) GetWorldTimerManager().ClearTimer(TimerHandle);
}
Shows a countdown timer in Blueprint with optional C++ timer handling.
Unreal Engine Simple Door Interaction
// Blueprint: Door Actor
// Add Static Mesh and Box Collision
// OnOverlap toggle door open animation
/* C++ Example: Door.cpp */
#include "Door.h"
#include "Components/StaticMeshComponent.h"
#include "Engine/Engine.h"
void ADoor::ToggleDoor() {
IsOpen = !IsOpen;
float TargetRotation = IsOpen ? 90.f : 0.f;
SetActorRotation(FRotator(0, TargetRotation, 0));
UE_LOG(LogTemp, Warning, TEXT("Door %s"), IsOpen ? TEXT("Opened") : TEXT("Closed"));
}
Demonstrates interacting with a door actor using Blueprints and C++.
Unreal Engine Simple Projectile
// Blueprint: Projectile Actor
// Add Sphere Collision + Projectile Movement
// On Hit -> Destroy
/* C++ Example: Projectile.cpp */
#include "Projectile.h"
#include "GameFramework/ProjectileMovementComponent.h"
AProjectile::AProjectile() {
ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileMovement"));
ProjectileMovement->InitialSpeed = 1000.f;
ProjectileMovement->MaxSpeed = 1000.f;
}
void AProjectile::NotifyHit(UPrimitiveComponent* MyComp, AActor* Other, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) {
Destroy();
}
Blueprint projectile with optional C++ movement logic using ProjectileMovementComponent.
Unreal Engine Simple Enemy AI
// Blueprint: AIController + BehaviorTree
// Add Blackboard variables for PatrolPoints
/* C++ Example: EnemyAI.cpp */
#include "EnemyAI.h"
#include "Kismet/GameplayStatics.h"
void AEnemyAI::Tick(float DeltaTime) {
Super::Tick(DeltaTime);
if (ACharacter* Player = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0)) {
MoveToActor(Player, 200.f);
}
}
Basic AI behavior tree setup with optional C++ patrol logic.
Unreal Engine Basic UI Blueprint
// Blueprint: Widget Blueprint (WBP_HUD)
// Add Text Block bound to Player Score variable
/* C++ Example: MyHUD.cpp */
#include "MyHUD.h"
#include "Blueprint/UserWidget.h"
void AMyHUD::BeginPlay() {
Super::BeginPlay();
if (HUDWidgetClass) {
UUserWidget* Widget = CreateWidget<UUserWidget>(GetWorld(), HUDWidgetClass);
Widget->AddToViewport();
}
}
Creates a simple HUD using UMG Blueprints with optional data binding from C++.
Unreal Engine Scene Switcher
// Blueprint: Level Blueprint
// Use Open Level node with LevelName
/* C++ Example: SceneSwitcher.cpp */
#include "Kismet/GameplayStatics.h"
void USceneSwitcher::SwitchTo(FName LevelName) {
UGameplayStatics::OpenLevel(GetWorld(), LevelName);
}
Switches between levels using Blueprint nodes or C++ OpenLevel call.
Frequently Asked Questions about Unreal-engine
What is Unreal-engine?
Unreal Engine is a high-end, real-time 3D creation platform developed by Epic Games, used for building AAA games, cinematic experiences, virtual production, simulations, architecture visualization, and interactive applications with photorealistic graphics.
What are the primary use cases for Unreal-engine?
AAA 3D games. Virtual production and filmmaking. Architecture visualization. Simulation and training apps. Digital twins and industrial visualization
What are the strengths of Unreal-engine?
Best-in-class photorealistic graphics. Robust tools for film, games, and simulation. No-code logic via Blueprint. Open-source engine (with source access). Scales to huge worlds and AAA-level fidelity
What are the limitations of Unreal-engine?
Much heavier learning curve than Unity. High hardware requirements. Large build sizes. Overkill for small indie/mobile games. C++ complexity for advanced systems
How can I practice Unreal-engine typing speed?
CodeSpeedTest offers 10+ real Unreal-engine code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.