Unity Editor Bridge
Live two-way communication between EngineForge and a running Unity Editor instance via HTTP REST. The bridge enables the AI Agent to create GameObjects, add components, manipulate scenes, and control play mode, all in real-time.
How it works
- When the IDE detects a Unity project, it auto-deploys a C# editor plugin to
Assets/Editor/GameDevIDEBridge.cs - The plugin starts an HTTP server on ports 26742–26752 inside Unity Editor
- The plugin writes a discovery file to
Library/GameDevIDE/bridge.json with the active port - The IDE polls this file every 5 seconds to find the Unity instance
- Once discovered, all communication happens via HTTP request/response
Why HTTP REST
Unity Editor reloads the C# domain whenever scripts are compiled. WebSocket connections break on every domain reload. HTTP REST is stateless, so each request is independent, so domain reloads don't disrupt the bridge.
Connection status
The Project Panel shows the bridge state. Click the status indicator to trigger a manual reconnection attempt.
- Connected - Commands execute in real-time
- Connecting - Searching for bridge.json
- Disconnected - Unity Editor not running or plugin not loaded
HTTP endpoints
| Method | Path | Purpose |
|---|
| GET | /status | Health check |
| POST | /command | Execute a single command |
| POST | /batch | Execute an array of commands in one frame |
| GET | /events | Drain buffered events (console logs) |
Batch execution
All bridge commands from a single AI response are collected and sent as one POST /batch request. This reduces hundreds of individual HTTP calls to a single request, executing all commands in one Unity editor frame.
Command categories
Scene
| Action | Description |
|---|
getActive | Get the currently open scene name and path |
getHierarchy | Get full scene tree with transforms, components, and canvas info |
create | Create a new blank scene (Camera + Light only) |
open | Open an existing scene file |
save | Save the current scene |
GameObject
| Action | Description |
|---|
create | Create an empty GameObject |
createPrimitive | Create a primitive (Cube, Sphere, Capsule, Cylinder, Plane, Quad) |
find | Find a GameObject by name or path |
destroy | Delete a GameObject |
setActive | Enable or disable a GameObject |
setTransform | Set position, rotation, and scale |
Component
| Action | Description |
|---|
add | Add a component to a GameObject |
remove | Remove a component |
getAll | List all components on a GameObject |
setProperty | Set a serialized field or property value |
Prefab
| Action | Description |
|---|
create | Save a GameObject as a prefab |
instantiate | Spawn a prefab instance in the scene |
getAll | List all prefabs in the project |
Asset
| Action | Description |
|---|
create | Create an asset (Material, PhysicMaterial) |
find | Find an asset by name or path |
import | Import an external asset file |
Project
| Action | Description |
|---|
getInfo | Get project name, version, platform, screen size |
refresh | Refresh the asset database |
Editor
| Action | Description |
|---|
getPlayMode | Check if the editor is in play mode |
play | Enter play mode |
pause | Pause play mode |
stop | Exit play mode |
getConsoleLogs | Retrieve recent console log entries |
executeMenuItem | Execute a Unity menu item |
getScreenInfo | Get screen resolution and canvas reference data |
Smart features
Auto-configured CanvasScaler
When the AI adds a CanvasScaler component, the plugin automatically sets it to “Scale With Screen Size” mode and reads the reference resolution from PlayerSettings. The AI receives the configured values in the response so it can size UI elements correctly.
Type handling (SmartConvert)
The plugin intelligently converts string values to Unity types:
| Type | Input format |
|---|
| GameObject | Scene path, then asset database lookup |
| Component | Scene path → GetComponent |
| Sprite, Material, AudioClip | Asset path (e.g. “Assets/Sprites/Icon.png”) |
| Enum | Case-insensitive name or integer value |
| Vector2/3/4 | [x,y,z] or (x,y,z) |
| Color | Hex #RRGGBB or RGBA (r,g,b,a) |
Retry on domain reload
If a batch request fails because Unity is reloading the C# domain, the IDE waits up to 120 seconds for reconnection, then re-sends all failed commands.
Timeouts
| Setting | Value |
|---|
| Single command timeout | 15 seconds |
| Batch timeout | 60 seconds |
| Discovery poll interval | 5 seconds |
| Event poll interval | 2 seconds |
| Reconnection wait | 120 seconds |