Documentation

Installation

Install Unity API Communicator via the Unity Package Manager:

  1. Open Window > Package Manager
  2. Click + > Add package from disk...
  3. Select package.json from the UAC folder
  4. Server starts automatically on port 7777

Quick Start

Test the API with a simple curl command:

curl http://localhost:7777/api/status

Response:

{
  "success": true,
  "data": {
    "server": "Unity API Communicator",
    "version": "1.2.2",
    "unity": "6000.0.0f1"
  }
}

Configuration

Open Tools > Editor API Communicator > Server Settings to configure:

Setting Default Description
Host localhost Server address (* for all interfaces)
Port 7777 Server port
Auto Start true Start server when Unity opens
Enable CORS true Allow cross-origin requests

Discovery API

Discover all available endpoints programmatically:

GET /api/discover

Returns all available endpoints with their methods and descriptions.

curl http://localhost:7777/api/discover

GET /api/categories

Returns list of endpoint categories.

curl http://localhost:7777/api/categories

POST /api/help

Get detailed help for a specific endpoint.

curl -X POST http://localhost:7777/api/help \
  -H "Content-Type: application/json" \
  -d '{"path": "/api/gameobject/create"}'

GameObject API

POST /api/gameobject/create

Create a new GameObject.

curl -X POST http://localhost:7777/api/gameobject/create \
  -H "Content-Type: application/json" \
  -d '{
    "name": "MyCube",
    "type": "Cube",
    "x": 0, "y": 1, "z": 0
  }'

GET /api/gameobject/list

List all GameObjects in scene.

POST /api/gameobject/transform

Transform a GameObject (position, rotation, scale).

curl -X POST http://localhost:7777/api/gameobject/transform \
  -H "Content-Type: application/json" \
  -d '{
    "name": "MyCube",
    "x": 5, "y": 2, "z": 0,
    "scaleX": 2, "scaleY": 2, "scaleZ": 2
  }'

POST /api/gameobject/delete

Delete a GameObject by name.

Scene API

POST /api/scene/new

Create a new scene.

POST /api/scene/save

Save current scene.

GET /api/scene/list

List all scenes in project.

Terrain API PRO

17 endpoints for procedural terrain generation.

POST /api/terrain/create

Create a new terrain.

curl -X POST http://localhost:7777/api/terrain/create \
  -H "Content-Type: application/json" \
  -d '{
    "name": "MyTerrain",
    "width": 500,
    "height": 300,
    "length": 500
  }'

POST /api/terrain/height/noise

Apply Perlin noise heightmap.

POST /api/terrain/paint

Paint terrain textures.

POST /api/terrain/trees/add

Add trees to terrain.

POST /api/terrain/grass/add

Add grass details.

Execute API PRO

Call any static method via reflection.

curl -X POST http://localhost:7777/api/execute \
  -H "Content-Type: application/json" \
  -d '{
    "className": "UnityEditor.PlayerSettings",
    "methodName": "get_productName"
  }'

Material API PRO

Control materials and shader properties.

POST /api/material/color

Set material color property.

curl -X POST http://localhost:7777/api/material/color \
  -H "Content-Type: application/json" \
  -d '{
    "materialPath": "Assets/Materials/MyMaterial.mat",
    "property": "_Color",
    "r": 1, "g": 0, "b": 0, "a": 1
  }'

POST /api/material/float

Set material float property (smoothness, metallic, etc).

POST /api/material/texture

Set material texture.

POST /api/material/shader

Change material shader.

WebSocket Streaming PRO

Real-time event streaming from Unity Editor via WebSocket. Connect to ws://localhost:7778 and subscribe to channels.

Connection

const ws = new WebSocket('ws://localhost:7778');

ws.onopen = () => {
    ws.send(JSON.stringify({
        type: 'subscribe',
        channels: ['console', 'selection', 'editor']
    }));
};

ws.onmessage = (event) => {
    const data = JSON.parse(event.data);
    console.log(data.channel, data.event, data.data);
};

Available Channels

Channel Events Description
console log, warning, error Unity Console messages
compilation started, completed, failed Script compilation
selection changed Editor selection changes
editor playModeChanged, pauseChanged Editor state changes
asset imported, deleted, moved Asset modifications
hierarchy changed Scene hierarchy changes
undo performed Undo/Redo operations
build started, completed, failed Build process
scene dirtied, saved Scene modifications
prefab updated Prefab instances
component added Component additions
project changed Project settings

Event Format

{
  "channel": "console",
  "event": "log",
  "data": {
    "message": "Hello from Unity!",
    "stackTrace": "",
    "timestamp": "2025-12-29T21:00:00Z"
  }
}

AI Integration Guide

For AI agents (Claude, ChatGPT, Copilot), always start by discovering available endpoints:

# 1. Discover all endpoints
curl http://localhost:7777/api/discover

# 2. Get categories
curl http://localhost:7777/api/categories

# 3. Get help for specific endpoint
curl -X POST http://localhost:7777/api/help \
  -d '{"path": "/api/terrain/create"}'