Home › Unreal Engine (C++) › Unreal Engine 5 C++ gameplay rules

Unreal Engine 5 C++ gameplay rules

Cursor rules for Unreal Engine 5 gameplay C++: UObject reflection, TObjectPtr, Enhanced Input, components, and Blueprint APIs.

CursorUnreal Engine (C++)

How to use

Save this as .cursor/rules/unreal-gameplay.mdc in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

.cursor/rules/unreal-gameplay.mdcDownload  
---
description: Unreal Engine 5 C++ gameplay conventions
globs: ["Source/**/*.{h,cpp}","**/*.Build.cs"]
alwaysApply: false
---

# Unreal Engine 5 gameplay (C++)

- Reflection macros on everything the engine or Blueprints touch: `UCLASS()`, `USTRUCT(BlueprintType)`, `UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Combat")`, `UFUNCTION(BlueprintCallable)`. Include `"X.generated.h"` last.
- UObject pointers in headers are `TObjectPtr<T>` members marked `UPROPERTY()` so GC tracks them; use `TWeakObjectPtr` for non-owning references that may die. Never raw `new`/`delete` UObjects; create with `CreateDefaultSubobject` (constructor) or `NewObject`/`SpawnActor`.
- Prefer composition with `UActorComponent`s over deep actor inheritance.
- Input with Enhanced Input: `UInputAction`/`UInputMappingContext` assets, bound in `SetupPlayerInputComponent` via `UEnhancedInputComponent::BindAction`.
- Expose tuning values as `EditDefaultsOnly` properties or Data Assets; designers tune in Blueprint subclasses, C++ owns logic.
- Use `BlueprintImplementableEvent`/`BlueprintNativeEvent` for designer hooks.
- Tick: disable (`PrimaryActorTick.bCanEverTick = false`) unless needed; use timers (`GetWorldTimerManager().SetTimer`) or events.
- Use `UE_LOG(LogMyGame, Warning, TEXT("..."))` with a declared log category; `check`/`ensure` for invariants.
- Gameplay Ability System for abilities/attributes if the project uses it; don't build a parallel system.
- Keep includes minimal in headers (forward declare), include what you use in `.cpp`.

## Done when
The editor target builds (`Build.bat <Project>Editor Win64 Development` or via IDE) with no new warnings, and Live Coding/hot reload is not relied on for header changes (restart the editor).

More: all Unreal Engine (C++) rules · all Cursor rules

Related rules

Unreal Engine C++ CLAUDE.md

CLAUDE.md for Unreal Engine 5 C++ gameplay code: UPROPERTY rules, GC safety, and Blueprint exposure.

Claude Code (CLAUDE.md)Unreal Engine (C++)

Unreal Engine multiplayer AGENTS.md

AGENTS.md for Unreal Engine 5 multiplayer: authority, replication, RPCs, prediction, and testing with multiple clients.

AGENTS.mdUnreal Engine (C++)

Godot 4 C# rules

Cursor rules for Godot 4.x games written in C# (.NET 8): node scripts, signals, exports, and performance.

CursorGodot

LÖVE (Love2D) Lua game rules

Cursor rules for 2D games with LÖVE 11.5 in Lua: callbacks, modules, delta time, asset loading, and performance.

CursorLÖVE (Love2D)

Roblox Luau rules

Cursor rules for Roblox experiences in Luau: strict typing, client/server boundaries, remotes, and data saving.

CursorRoblox (Luau)

Three.js rules

Cursor rules for Three.js (r17x, ES modules) web 3D and games: render loop, disposal, assets, and performance.

CursorThree.js

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.