Beginner 10 min read

Claude Code Integration

Set up Claude Code to control your Unreal Engine project with natural language commands. Say "spawn a camera" and watch it happen in the editor.

In This Tutorial

  1. What is Claude Code?
  2. Setting Up the Connection
  3. Understanding CLAUDE.md
  4. Natural Language Commands
  5. Real-World Examples
  6. Tips & Best Practices

1 What is Claude Code?

Claude Code is Anthropic's AI coding assistant that can read, write, and execute code in your development environment. When combined with CLAUDIUS, Claude Code can directly control Unreal Engine through natural language commands.

Instead of manually writing JSON commands or clicking through menus, you can simply tell Claude what you want:

Claude Code Conversation
You

Spawn a cinematic camera at position 500, 0, 200 looking down at the scene

C

I'll spawn a CineCameraActor at that position with a downward pitch angle. Writing the command to claudius_request.json...

Done! The camera "MainCamera" has been spawned at (500, 0, 200) with rotation (pitch: -30, yaw: 0, roll: 0). You should see it in your viewport now.

Why This Works

CLAUDIUS includes a CLAUDE.md file that Claude Code automatically reads. This file contains complete documentation of all 130+ commands, so Claude knows exactly how to translate your requests into the correct JSON format.

2 Setting Up the Connection

Step 2.1: Install Claude Code

If you haven't already, install Claude Code from Anthropic. It works as a VS Code extension or standalone application.

Step 2.2: Open Your Project

Open your Unreal project folder in Claude Code. Make sure CLAUDIUS is installed and the editor is running with your project loaded.

Terminal
# Open your project folder in Claude Code
cd C:\Projects\MyUnrealProject
claude-code .

# Or in VS Code with Claude extension:
code C:\Projects\MyUnrealProject

Step 2.3: Copy CLAUDE.md to Project Root (Required!)

For Claude Code to understand CLAUDIUS commands, you must copy the CLAUDE.md file from the plugin folder to your project's root directory. This is the most important step!

Copy CLAUDE.md
# The CLAUDE.md file is located in the plugin folder:
YourProject/Plugins/Claudius/CLAUDE.md

# Copy it to your project root:
YourProject/CLAUDE.md

# Your project structure should look like this:
YourProject/
├── Content/
├── Config/
├── Plugins/
│   └── Claudius/
│       └── CLAUDE.md        # Original file (keep this)
├── claudius_request.json
├── claudius_response.json
└── CLAUDE.md                # ← Copy here for Claude Code!
This Step is Required!

Claude Code automatically reads CLAUDE.md files from your project root to learn about available tools and commands. Without this file in your root directory, Claude won't know about CLAUDIUS commands. Make sure to copy (not move) the file so you always have the original in the plugin folder.

Project folder showing CLAUDE.md file
After copying, CLAUDE.md should appear in your project root directory

Step 2.4: Test the Connection

Ask Claude to verify the setup by listing actors:

Testing the Connection
You

List all actors in the current level

C

I'll query the current level for all actors. Sending the list_actors command...

Found 24 actors in the level: Floor (StaticMeshActor), DirectionalLight, SkyLight, SkyAtmosphere, ExponentialHeightFog...

Troubleshooting

If Claude doesn't recognize CLAUDIUS commands, check these common issues:

  • CLAUDE.md not in project root – Copy it from Plugins/Claudius/CLAUDE.md to your project root
  • Unreal Editor not running – Make sure the editor is open with your project loaded
  • Plugin not enabled – Check Edit > Plugins and ensure CLAUDIUS is enabled

3 Understanding CLAUDE.md

The CLAUDE.md file is the key to making Claude understand CLAUDIUS. It contains:

CLAUDE.md (excerpt)
# CLAUDIUS Command Reference

## File-Based Communication
Write commands to `claudius_request.json`, responses appear in `claudius_response.json`.

## Command Format
```json
{
  "command_id": "unique_id",
  "category": "level|editor|console|...",
  "command": "command_name",
  "params": { ... }
}
```

## Level Commands

### spawn_actor
Spawns an actor in the current level.

Parameters:
- class_path (string, required): Actor class path
- location (object): {x, y, z}
- rotation (object): {pitch, yaw, roll}
- actor_label (string): Display name

Example:
```json
{
  "command_id": "spawn_1",
  "category": "level",
  "command": "spawn_actor",
  "params": {
    "class_path": "/Script/Engine.PointLight",
    "location": {"x": 0, "y": 0, "z": 300}
  }
}
```
Automatic Context

Claude Code reads CLAUDE.md automatically when you open the project. You don't need to tell Claude about it—just start asking for things and Claude will know what commands to use.

4 Natural Language Commands

With CLAUDIUS + Claude Code, you can express commands naturally. Claude translates your intent into the correct JSON format. Here are examples across different categories:

Level Operations

Natural Language → JSON
// You say:
"Spawn a point light at 0, 0, 500"

// Claude writes:
{
  "command_id": "spawn_light_001",
  "category": "level",
  "command": "spawn_actor",
  "params": {
    "class_path": "/Script/Engine.PointLight",
    "location": { "x": 0, "y": 0, "z": 500 }
  }
}

Editor Operations

Editor Commands
// "Select the actor named PlayerStart"
{ "category": "editor", "command": "select_actor", "params": { "actor_name": "PlayerStart" } }

// "Take a screenshot of the viewport"
{ "category": "viewport", "command": "take_screenshot", "params": {} }

// "Compile all blueprints"
{ "category": "build", "command": "compile_blueprints", "params": {} }

Complex Multi-Step Tasks

Claude can chain multiple commands together for complex operations:

Multi-Step Operations
You

Create a simple scene with a floor, 4 point lights in a square pattern, and a camera looking at the center

C

I'll create that scene for you. Let me execute these commands in sequence:

1. Spawning floor plane at origin...

2. Spawning 4 point lights at positions (500, 500), (-500, 500), (-500, -500), (500, -500)...

3. Spawning camera at (0, -800, 400) looking toward origin...

All done! Your scene now has a floor, 4 point lights in a square pattern, and a camera positioned to view the center.

5 Real-World Examples

Example 1: Setting Up a Character Test Scene

Character Test Scene
You

I need to test my character Blueprint. Create a test level with a flat floor, good lighting, and spawn my BP_PlayerCharacter in the center

C

I'll set up a test environment for your character. Creating the level elements now...

Created: Floor mesh, Directional Light (Sun), Sky Light for ambient, BP_PlayerCharacter at (0, 0, 100). The lighting is configured for clear visibility. Would you like me to start PIE so you can test the character?

Example 2: Debugging AI Behavior

AI Debugging
You

Start PIE, then set the blackboard value "TargetLocation" on my AI enemy to 500, 500, 0

C

Starting Play-In-Editor... PIE is now running.

Setting blackboard value "TargetLocation" on the AI enemy... Done! The AI should now move toward position (500, 500, 0). Would you like me to monitor its behavior or change any other values?

Example 3: Asset Pipeline

Asset Import
You

Import the FBX file from C:\Assets\character.fbx into /Game/Characters/ and create a material instance from M_Character_Base

C

Importing the FBX file... Import successful! The skeletal mesh is now at /Game/Characters/character.

Creating material instance from M_Character_Base... Created MI_Character at /Game/Characters/MI_Character. Would you like me to apply this material to the imported mesh?

6 Tips & Best Practices

Be Specific with Positions

When specifying locations, use concrete numbers. Claude understands coordinates in Unreal's coordinate system (X forward, Y right, Z up).

Good vs. Vague

Good: "Spawn a light at 0, 0, 300"
Vague: "Put a light somewhere above the scene"

Use Actor Labels

Ask Claude to name actors when spawning them. This makes it easier to reference them later.

Chain Related Commands

Don't hesitate to ask for multi-step operations. Claude will execute them in the correct order and report the results.

Check Responses

Claude will tell you if a command failed. If something doesn't work, ask Claude to check the response file for error details.

Important

CLAUDIUS commands modify your level! Use version control (Git, Perforce) so you can revert changes if needed. Consider testing in a separate level before modifying important content.

Previous Tutorial
Quick Start Guide