Available now | Open source

Unity Code Agent

The open-source agent inside Unity Editor.

Unity Code Agent is an agent designed for long-running autonomous tasks directly inside the Unity Editor.

It works across project files and live game state, using Unity Editor APIs to complete and verify tasks.

Supports Skills, custom tools, MCP servers, BYOK providers and Github Copilot subscription (free and paid).

Unity Code Agent creating and testing a Snake game in the Unity Editor
Unity Code Agent building Snake game, more in Example.

Features

Unity Code Agent can complete focused changes and multi-step features. It can create or update C# code, scenes, prefabs, MonoBehaviours, ScriptableObjects, project configuration, and references, then test and verify the result in the Editor or Play Mode.

Example tasks:

  • Add a gameplay component, attach it to the correct objects, configure its fields, and confirm the scene starts without errors.
  • Create or update prefabs and ScriptableObjects in bulk based on provided data.
  • Implement a UI change, enter Play Mode, navigate the relevant input path, and inspect the visible result.
  • Run an Edit Mode or Play Mode test, fix the failure, and rerun it.
  • Validate a short gameplay condition such as movement, a menu transition, a collision response, or a state change.
  • Implement a game feature, create and run tests, analyze screenshots, and play the game to verify the result.

Architecture

Example task: building a Snake game

The following task includes:

  • Installing the required assets.
  • Creating an image.
  • Creating input actions.
  • Implementing game logic based on a specification.
  • Testing game in play mode.

Create a Snake game. Target resolution: 1920x1080. Grid size: 32x32. The game should fill the screen.
Install TextMesh Pro assets.
Create a 32x32 white PNG sprite and use it for the visuals.
The snake should be light gray with a white head. Food should appear in a random bright color.
Use the new Input System for controls. Create new Input Actions for Up, Down, Left, and Right, bind them to the keyboard arrow keys, and use them.
Show the score at the top center. Show a Game Over screen with the score and allow the player to restart by pressing any key.
The snake should speed up by a configurable percentage after eating food. The amount of length added after eating food should also be configurable.
Follow Unity best practices for game development. Use the MVC pattern.
Verify the work using 'play unity game'. Verification should cover movement, eating food, snake growth, collision detection, scoring, and game-over conditions.

Results depend on model capability, request clarity, and project complexity.

Following example took 19 minutes and cost around $0.40.

Unity Code Agent creating and testing a Snake game in the Unity Editor
Unity Code Agent building Snake game.

Verification in the Editor and Play Mode

Verification runs as part of implementation. The agent evaluates compiler errors, test results, Console messages, runtime values, and Game View output. If a check fails, it can update the implementation and run the check again.

Checks can catch broken references, startup exceptions, input regressions, incorrect state transitions, and visible configuration mistakes.

Vision-capable models can analyze captured Game View screenshots.

Provider and model selection

  • BYOK (bring your own key) with an OpenAI-compatible endpoint.
  • GitHub Copilot, including free and paid subscriptions.

Built-in Unity tools

Built-in tools connect the agent to the active Unity project. The agent can execute C# with full Editor API access, read Console output and project state, run Edit Mode and Play Mode tests, control Play Mode, simulate configured Input System actions, and capture Game View screenshots. These operations support project inspection, implementation, reproduction, and verification.

execute_csharp_script_in_unity_editor
Execute generated C# scripts with full Unity Editor API access and modify scenes, assets, configuration and more.
read_unity_console_logs
Read live Unity Console output from the current project.
run_unity_tests
Run EditMode or PlayMode tests and bring the results back into the agent workflow.
enter_play_mode, exit_play_mode
Move the editor into Play Mode as part of a gameplay automation loop.
play_unity_game
Automate gameplay with input actions so agents can validate in-game behavior.
get_unity_game_view_window_screenshot
Capture the current Game View screenshot.
get_unity_info
Return information about the current Unity Editor project and Agent settings.

Available extensions

The built-in tools cover common Unity implementation and verification work. Additionally, agent capabilities can be improved through three extension points:

Skills
Supply reusable instructions for defined workflows. The package includes skills for Unity Editor scripting and game-playing checks.
Custom tools
Expose project-specific C# operations. Synchronous and asynchronous implementations are discovered and registered automatically.
MCP servers
Connect the agent to local or remote tools and services over stdio, HTTP, or SSE transports.

Unity Code Agent and Unity Code MCP Server

Unity Code Agent includes the agent runtime, Editor chat, sessions, provider configuration, skills, extension points, and Unity tools in one package.

Unity Code MCP Server exposes Unity tools to an external MCP-compatible agent. It complements Unity Code Agent by supporting developers who prefer to keep their existing agent and coding environment.

Latest release

July 2026

Unity Code Agent v0.2 Release Notes

The 0.2 release adds visual Game View inspection, clearer response controls, project-specific sessions, safer C# execution, and stronger Unity workflow guidance.

Requirements

  • Unity 6000.3 or newer. Older versions may work but are not officially supported.
  • .NET 8 SDK.
  • Access to an OpenAI-compatible model provider or GitHub Copilot subscription.

Installation

Install from Unity Package Manager:

  1. Open Window > Package Manager.
  2. Select + > Add package from git URL....
  3. Enter:
https://github.com/Signal-Loop/UnityCodeAgent.git?path=Packages/com.signal-loop.unitycodeagent

Quickstart

Unity Code Agent supports two authentication/provider methods: BYOK and GitHub Copilot (free and paid).

BYOK

  1. Open Tools > UnityCodeAgent > Open Settings.
  2. In BYOK, set BaseUrl to the full HTTPS provider base URL and enter ApiKey. For example, https://openrouter.ai/api/v1 and sk-....
  3. In Model, click Refresh. On first run or after an update, Agent Service code is compiled and started in the background. This may take a few seconds.
  4. Select a model from the dropdown.
  5. Open Tools > UnityCodeAgent > Open Chat.
  6. Try a prompt such as List scene objects.

If no BYOK base URL is set, UnityCodeAgent uses the default GitHub Copilot authentication flow instead.

GitHub Copilot

  1. Sign in to GitHub Copilot on the machine before using the Unity package. Refer to the GitHub Copilot authentication guide for details.
  2. Open Tools > UnityCodeAgent > Open Settings.
  3. Leave BYOK > BaseUrl empty.
  4. In Model, click Refresh. On first run or after an update, Agent Service code is compiled and started in the background. This may take a few seconds.
  5. Select a model from the dropdown.
  6. Open Tools > UnityCodeAgent > Open Chat.
  7. Try a prompt such as List scene objects.

After changing authentication, provider settings, or model settings, use Tools > UnityCodeAgent > Restart Agent Service before refreshing models if the old service process is still running.

Security risks

Unity Code Agent executes AI-generated C# with Unity Editor privileges. Use it at your own risk. To the fullest extent permitted by law, Signal Loop disclaims liability for any changes, damage, or data loss resulting from its use. You are responsible for securing your environment.

Learn more