Unity Editor HTTP API

A REST API server for controlling Unity Editor via HTTP. Perfect for AI agents, automation scripts, CI/CD pipelines, and external tools.

Views1
PublishedJan 14, 2026

Loading actions...

5 minBeginnerpromptSingle file

Skill content

Main instructions and any bundled files for this skill.

markdown

Unity Editor HTTP API

A REST API server for controlling Unity Editor via HTTP. Perfect for AI agents, automation scripts, CI/CD pipelines, and external tools.

Installation

  1. Copy the com.fubz.unity-editor-api folder to your project's Packages/ directory
  2. Unity will automatically detect and import the package

Option 2: Git URL

Add to your Packages/manifest.json:

{
  "dependencies": {
    "com.fubz.unity-editor-api": "https://github.com/YOUR_USERNAME/unity-editor-api.git"
  }
}

Option 3: OpenUPM (if published)

openupm add com.fubz.unity-editor-api

Quick Start

The server starts automatically when Unity opens. Access it at http://localhost:8091.

# Check if server is running
curl http://localhost:8091/api/help

# Get console logs
curl "http://localhost:8091/api/logs?type=error&limit=10"

# Enter play mode
curl -X POST http://localhost:8091/api/playmode -d '{"action":"play"}'

# Load a scene
curl -X POST http://localhost:8091/api/scene/load -d '{"path":"Assets/Scenes/Main.unity"}'

API Reference

Console & Debugging

EndpointMethodDescription
/api/helpGETAPI documentation
/api/logs?type=error&limit=20GETConsole logs (type: error|warning|log)

Play Mode Control

EndpointMethodBodyDescription
/api/playmodeGET-Check play mode state
/api/playmodePOST{"action":"play|stop|pause|resume"}Control play mode

Scene Management

EndpointMethodBodyDescription
/api/scene/listGET-List all scenes in project
/api/scene/currentGET-Get current scene info
/api/scene/loadPOST{"path":"Assets/.../Scene.unity"}Load a scene
/api/hierarchyGET-Get scene hierarchy

Editor Operations

EndpointMethodBodyDescription
/api/recompilePOST-Trigger script recompilation
/api/savePOST{"what":"scene|project|all"}Save scene/project
/api/menuPOST{"path":"File/Save"}Execute menu item
/api/selectPOST{"name":"Main Camera"}Select GameObject
/api/projectGET-Get project info

Configuration

Access settings via Tools > Editor API > Open Settings

  • Port: Default 8091
  • Auto Start: Automatically start server when Unity opens

Claude Code Integration

This package includes a ready-to-use skill file for Claude Code.

Setup

Copy the skill to your project's .claude/skills/ folder:

# From your Unity project root
mkdir -p .claude/skills/unity-editor-api
cp Packages/com.fubz.unity-editor-api/ClaudeCode/SKILL.md .claude/skills/unity-editor-api/

Or symlink it:

mkdir -p .claude/skills
ln -s ../../Packages/com.fubz.unity-editor-api/ClaudeCode .claude/skills/unity-editor-api

What Claude Code Can Do

With this skill, Claude Code can:

  • Check for compile errors after code changes
  • Enter/exit play mode
  • Load scenes
  • Trigger recompilation
  • Inspect scene hierarchy
  • Execute menu items
  • Save scenes and project

Response Format

All endpoints return JSON:

// Success
{"success": true, "data": ...}

// Error
{"error": "Description of what went wrong"}

Tips

  1. Background Operation: Enable "Run In Background" in Player Settings for reliable operation when Unity isn't focused
  2. CORS: All endpoints include CORS headers for browser-based tools
  3. Timeouts: Operations have built-in timeouts (2-10 seconds depending on operation)

License

MIT

Share: