Skip to main content

Editor View

Overview

Editor View allows you to directly control the Unity/Tuanjie Editor from within the AI conversation interface. It is not a 3D WebGL scene viewer, but a tool execution and result display system — it communicates in real-time with a running Unity Editor via TCP bridging, presenting tool call results as cards in the chat interface.

Supported Engines

  • Unity
  • Tuanjie

Requirements & Installation

Prerequisites

ItemRequirement
Node.js≥ 20.19.0
Unity EditorMust be running with a project open
Bridge Packagecn.tuanjie.codely.bridge

Install Unity Bridge Package

Refer to Connect Unity/Tuanjie Editor

Project Detection

The system automatically detects whether the current directory is a Unity project, checking:

  • Whether Unity project identifier files exist in the project root
  • Whether the cn.tuanjie.codely.bridge MCP package is installed
  • Engine type (Unity or Tuanjie) and version number

Connection Status & Indicators

Status Types

StatusMeaningIcon Color
connectedConnected to Unity Editor🟢 Green
connectingConnecting🟡 Yellow
not-connectedNot connected-
reconnectingReconnecting🟡 Yellow
errorConnection error🔴 Red

Screenshot Feature

Supported Camera Types

CameraDescription
Game ViewGame view screenshot
Scene ViewScene view screenshot
Main CameraMain camera screenshot
Custom CameraSpecified camera screenshot

Screenshot Card UI

After a screenshot is captured, a screenshot card appears in the chat interface:

  • Displays the screenshot image (object-fit: contain, max height 400px)
  • Labels the camera view source (Game View / Scene View)
  • Shows spinning animation while loading
  • Shows error state if screenshot fails
  • Supports click to enlarge

Additional Options

  • Custom resolution
  • Orthographic projection mode
Take a screenshot of the Game View
Take a 1920x1080 screenshot from the Scene View

Troubleshooting

Common Issues

IssueCauseSolution
Status shows "Not connected"Unity Editor not running or bridge package not installedStart Unity Editor and confirm bridge package is installed
Frequent disconnections after connectingTCP port occupied or firewall blockingCheck if port 25916 is available, check firewall rules
Tool calls unresponsiveUnity Editor is compiling/loadingWait for compilation to finish and retry
Script modification errorsCompilation failureCheck console error logs and fix code
Screenshot capture failedGame View not open or camera doesn't existEnsure the target view/camera is available
Asset generation stuck at progressGenerator error or network issueCheck Unity console errors, confirm network connection

Best Practices

  1. Read before write: Read current state before modifying to avoid overwriting important changes
  2. Prefer idempotent operations: Use ensure_* operations instead of add/create to avoid duplicates
  3. Compile verification: Always check compilation results after modifying scripts
  4. Save scene: Save the scene before baking, playing, or completing important operations
  5. Console separation: Record sinceToken before risky operations to only focus on new logs
  6. Avoid write during Play Mode: Don't modify the scene in Play Mode unless explicitly debugging Play behavior

Reset Connection

If the connection is abnormal, try:

  1. Click the Unity toggle button to disable and re-enable
  2. Re-import the bridge package in the Unity Editor
  3. Restart the Unity Editor

Appendix: Tool Output Card Types

The UnityToolOutput component renders different cards based on the tool and operation return data types:

Output TypeRendered Form
Console logsLog entry list
GameObject infoObject detail card
Component listComponent property table
Data gridTable format
WarningYellow alert bar
ErrorRed error card
ScreenshotImage display
Asset previewScaled preview image + metadata
JSON dataFormatted code block