Onboarding · Unreal Engine 5.7 · C++

Agents on Unreal

Cursor is the shell; Claude Code and Codex run inside it. Debugger and profiler stay in Rider or Visual Studio.

setup ≈ 40 min UE 5.7 Windows · Perforce

Setup

Step 3 without step 4 will bury the index.

  1. 01

    Cursor

    Install, sign in. It is a VS Code fork — extensions, themes and keybinds carry over.

  2. 02

    Both agents

    They run in the Cursor terminal, against the tree open in the editor.

    # Claude Code — long multi-file runs
    npm i -g @anthropic-ai/claude-code
    claude
    
    # Codex — CLI, or the extension (ID: openai.chatgpt)
    npm i -g @openai/codex
    codex

    Cursor's own agent is Ctrl+I. All three coexist. One rule: one agent per file at a time.

  3. 03

    IntelliSense: clangd

    Without it Cursor has no symbol navigation and no macro awareness on a UE project. Generate the compile database with UBT:

    "C:\Program Files\Epic Games\UE_5.7\Engine\Binaries\DotNET\
      UnrealBuildTool\UnrealBuildTool.exe" -mode=GenerateClangDatabase
      -project="D:\Proj\Game.uproject" -game -engine
      GameEditor Win64 Development

    compile_commands.json lands in the engine root — copy it to the project root. Install llvm-vs-code-extensions.vscode-clangd and disable Microsoft's C/C++ IntelliSense; two language servers on one project fight and both crawl.

    The same file also serves Claude Code — this gives it real symbol navigation instead of grep:

    /plugin install clangd-lsp@claude-plugins-official

    Not incremental — the file is rebuilt in full, around a minute. Rerun after adding a module or new .cpp files, not after every build. Dropping -engine from the UBT command shrinks the index a lot, at the cost of navigation into engine code.

  4. 04

    Keep junk out of the index

    .cursorignore in the project root:

    Binaries/
    Intermediate/
    DerivedDataCache/
    Saved/
    Content/
    *.uasset
    *.umap

    Intermediate and DerivedDataCache are tens of GB of generated code; Content is binary.

  5. 05

    AGENTS.md

    One file in the root, read by both Cursor and Codex. Next to it, a CLAUDE.md containing See AGENTS.md.

    # Game — Unreal Engine 5.7, C++20, IWYU
    
    Build:  Build.bat GameEditor Win64 Development -project=...
    Tests:  UnrealEditor-Cmd.exe ... -ExecCmds="Automation RunTests Game"
    
    ## Rules
    - API is UE 5.7. Never use UE4-era APIs. If unsure of a signature,
      read the header under Engine/Source/Runtime/ — do not guess.
    - Ask before writing. Never batch several file writes into one approval.
    - "X.generated.h" is ALWAYS the last include in a header.
    - Every UObject* member reachable from a UObject must be UPROPERTY()
      or the GC collects it. Use TObjectPtr<T> for members.
    - A new module dependency goes into Game.Build.cs in the same change.
    - Never touch Content/, *.uasset, *.umap — binary, unreadable to you.
    - Files are read-only under Perforce: run `p4 edit <file>` first.
    - Do not reformat files you did not otherwise need to change.

    Add a line every time the agent gets something wrong.

  6. 06

    Epic's plugin

    Official Epic plugin for Claude Code — hundreds of tools across 30+ toolsets: actors, blueprints, materials, Niagara, Sequencer, automation tests. It drives a running editor.

    # in Claude Code
    /plugin install unreal-engine-skills-for-claude-code@claude-plugins-official
    
    # in the editor: enable the ModelContextProtocol and AllToolsets plugins,
    # then in the console (default port 8000):
    ModelContextProtocol.StartServer

    Live access to the editor, and execute_tool_script runs arbitrary Python with full project rights. Keep per-action approval on. Submit to Perforce before a long session, not after.

What the agent cannot see

Reads

  • Source/**/*.h, *.cpp
  • *.Build.cs, *.Target.cs
  • Config/*.ini
  • logs, crash dumps, compiler output
  • engine source on disk

Cannot read

  • Blueprint graphs
  • materials, Niagara systems
  • anything under Content/
  • editor state
  • the running game

Logic that lives in Blueprints is out of reach: describe the graph, paste a screenshot, or move it to C++. Epic's plugin covers part of this — it talks to a running editor and can read and build graphs — but that is editor control, not repository access.

Designing with the agent

Separate session. No file writes. Output is a document.

  • Ask what the engine already has, first

    Gameplay Ability System, Subsystems, Enhanced Input, Gameplay Tags, DataAsset, Mass. It has all of Engine/Source and finds these faster than a docs search.

  • Ask for options, not an answer

    A single proposal gets shaped to fit your framing. Three with tradeoffs force it to say what is wrong with each.

  • Ask "what breaks", not "is this fine"

    It will agree with the second one.

  • You are the architect

    Left alone it produces generic designs — extra layers and interfaces for variation the project does not have. Its job is pressure and holes, not the decision.

Prompt to paste:

Task: <...>

Do not propose a solution yet. First:
1. What in UE 5.7 already solves this — with paths under Engine/Source.
2. Three architectures with tradeoffs.
3. What breaks in each: replication, scale, a year of maintenance.
4. What you would ask me before choosing.

Do not touch files. Output: docs/design/<name>.md

Cover per feature: the C++/Blueprint boundary; Actor vs ActorComponent vs Subsystem vs plain UObject; module boundaries and Build.cs dependencies (cycles are painful); what replicates; DataAsset/DataTable vs hardcoded; plugin vs game module.

Commit the doc. Every implementation session starts from it.

Working rules

  • Plan mode first

    Shift+Tab, in both Cursor and Claude Code. It reads the code, asks questions, writes a plan naming files, and waits. A wrong turn here costs a twenty-minute rebuild, not a revert.

  • Approve every action by hand

    Do not turn it off. This is where wrong turns get caught — and under Perforce, where other people's files stay out of your changelist.

  • One task, one session

    /clear when done. Leftover context degrades answers before it is noticeable.

  • Read the whole diff

    Which sets the task size: one reviewable PR per run.

  • The build is the test

    Build command in AGENTS.md; let it run and read the errors. It parses UE template errors faster than you do.

  • Never let it guess an API

    "Read Engine/Source/Runtime/Engine/Classes/GameFramework/Character.h and follow it" beats "write code using method X".

  • Split the agents by job

    Claude Code: long multi-file runs, reading unfamiliar code. Cursor agent: local edits in the open file. Codex: background task.

  • p4 edit first

    Otherwise it hits read-only files and invents workarounds instead of saying so.

  • Two misses in a row is the prompt

    Reword, add context, narrow scope. A third identical attempt will not work.

What models get wrong on UE

There is far more UE4 than UE5 in training data. Most of this compiles and fails at runtime.

WritesActually
UObject* member with no UPROPERTY() GC does not see the reference and collects the object — a runtime crash, not a compile error
AMyActor* Ptr; as a class member TObjectPtr<AMyActor> Ptr; — raw pointers stay local
FString for everything FName for identifiers and keys, FText for anything a player reads, FString for the rest
#include "X.generated.h" mid-list Always the last include in a header, or UHT fails
A new #include from another module The module goes into Build.cs in the same change, or the linker fails
FVector as float FVector is double in UE5. FVector3f for float precision; mixing gives silent conversion errors
"Restart Hot Reload" Hot Reload is deprecated. Live Coding is Ctrl+Alt+F11, and header changes still need a full rebuild
A confident answer about a method or plugin that does not exist Check Engine/Source. Confidence does not track correctness

Where to use it

Hand over

  • Boilerplate: UCLASS, USTRUCT, interfaces, delegates
  • Mechanical refactors and renames
  • "Explain subsystem X", with file references
  • Log and crash dump analysis
  • Automation tests
  • Editor utilities in Python
  • Build.cs, CI, tooling

Review closely, or do by hand

  • Networking and replication
  • Anything on a hot path
  • Gameplay feel
  • Rendering and shaders
  • Engine source edits
  • Anything touching binary assets