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 compiled plugin to Assets/Plugins/Editor/EngineForgeBridge.dll
  2. The plugin starts an HTTP server on ports 26742–26752 inside Unity Editor
  3. The plugin writes a discovery file toLibrary/EngineForge/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)
GET/capabilitiesList all registered tools

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
getSelectedGet the currently selected GameObject
renameRename a GameObject
duplicateDuplicate a GameObject
reparentMove a GameObject to a new parent
setTagLayerSet the tag and layer of a GameObject

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

Script

ActionDescription
createCreate a new C# script file
readRead the contents of a script
editEdit an existing script
findFind a script by name or path
deleteDelete a script file

Asset

ActionDescription
createCreate an asset (Material, PhysicMaterial)
findFind an asset by name or path
importImport an external asset file
createMaterialCreate a new material asset
setMaterialPropertySet a property on a material
getMaterialInfoGet material properties and shader info

Project

ActionDescription
getProjectInfoGet project name, version, platform, screen size
refreshRefresh the asset database
addPackageAdd a Unity package by name
listPackagesList installed packages

Editor

ActionDescription
playEnter play mode
stopExit play mode
pausePause play mode
getStateCheck editor state (playing, paused, stopped)
executeMenuItemExecute a Unity menu item
getScreenInfoGet screen resolution and canvas reference data

Console

ActionDescription
getLogsRetrieve recent console log entries
clearLogsClear the console log buffer

Screenshot

ActionDescription
captureCapture a screenshot of the game view

Animation

ActionDescription
playPlay an animation
stopStop an animation
getInfoGet animation clip info
setAnimatorParameterSet an Animator parameter value

UI

ActionDescription
createElementCreate a UI element with canvas setup

Physics

ActionDescription
raycastPerform a physics raycast

Lighting

ActionDescription
setLightingConfigure scene lighting settings
getLightingInfoGet current lighting configuration

Smart features

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 60 seconds for reconnection, then re-sends all failed commands.