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

  1. When the IDE detects a Unity project, it auto-deploys a C# editor plugin to Assets/Editor/GameDevIDEBridge.cs
  2. The plugin starts an HTTP server on ports 26742–26752 inside Unity Editor
  3. The plugin writes a discovery file toLibrary/GameDevIDE/bridge.json with the active port
  4. The IDE polls this file every 5 seconds to find the Unity instance
  5. 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

MethodPathPurpose
GET/statusHealth check
POST/commandExecute a single command
POST/batchExecute an array of commands in one frame
GET/eventsDrain 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

ActionDescription
getActiveGet the currently open scene name and path
getHierarchyGet full scene tree with transforms, components, and canvas info
createCreate a new blank scene (Camera + Light only)
openOpen an existing scene file
saveSave the current scene

GameObject

ActionDescription
createCreate an empty GameObject
createPrimitiveCreate a primitive (Cube, Sphere, Capsule, Cylinder, Plane, Quad)
findFind a GameObject by name or path
destroyDelete a GameObject
setActiveEnable or disable a GameObject
setTransformSet position, rotation, and scale

Component

ActionDescription
addAdd a component to a GameObject
removeRemove a component
getAllList all components on a GameObject
setPropertySet a serialized field or property value

Prefab

ActionDescription
createSave a GameObject as a prefab
instantiateSpawn a prefab instance in the scene
getAllList all prefabs in the project

Asset

ActionDescription
createCreate an asset (Material, PhysicMaterial)
findFind an asset by name or path
importImport an external asset file

Project

ActionDescription
getInfoGet project name, version, platform, screen size
refreshRefresh the asset database

Editor

ActionDescription
getPlayModeCheck if the editor is in play mode
playEnter play mode
pausePause play mode
stopExit play mode
getConsoleLogsRetrieve recent console log entries
executeMenuItemExecute a Unity menu item
getScreenInfoGet 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:

TypeInput format
GameObjectScene path, then asset database lookup
ComponentScene path → GetComponent
Sprite, Material, AudioClipAsset path (e.g. “Assets/Sprites/Icon.png”)
EnumCase-insensitive name or integer value
Vector2/3/4[x,y,z] or (x,y,z)
ColorHex #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

SettingValue
Single command timeout15 seconds
Batch timeout60 seconds
Discovery poll interval5 seconds
Event poll interval2 seconds
Reconnection wait120 seconds