Use coding agents with Unity Editor.
Chat with an agent inside Unity, or expose Unity tools to DotCraft, Claude Code, Codex, Cursor, and other agents.
| Workflow | Use this when | Entry point |
|---|---|---|
| In-Unity Agent Chat | You want to chat with DotCraft or another ACP agent inside Unity | Tools → DotCraft → AI Assistant |
| MCP Gateway | You want external MCP clients such as Claude Code, Codex, or Cursor to call Unity tools | Tools → DotCraft → MCP Gateway Setup |
| C# Automation | You want an agent to perform batch operations in Unity | unity_execute_csharp |
| Custom Tools | You want to expose project-specific Unity tools | [AgentTool] |
Open Window → Package Manager and add this Git URL:
https://github.com/DotHarness/dotcraft-unity.git
Minimum Unity version: 2021.3, recommended version: Unity 6.
- Install dotcraft-unity from Package Manager.
- Open Tools → DotCraft → AI Assistant.
- Select DotCraft or Custom ACP Agent in Project Settings → DotCraft.
- Click Connect.
- Open the Unity project.
- Enable Unity Tool Gateway in Project Settings → DotCraft.
- Run Tools → DotCraft → MCP Gateway Setup.
- Choose your client: Claude Code, Codex, or Cursor.
- Start your coding agent from the project root.
- Create a static Editor method marked with
[AgentTool]. - Let Unity compile.
- Enable the tool in Project Settings → DotCraft → Unity Tools.
- Use it from DotCraft or any MCP client connected through the MCP Gateway.
dotcraft-unity provides a stable MCP Gateway for coding agents, unaffected by domain reloads or editor restarts.
See Documentation~/tool-gateway.md for more details.
dotcraft-unity provides one built-in Unity runtime tool based on Roslyn:
| Tool | Description |
|---|---|
unity_execute_csharp |
Compile and execute a C# method-body snippet in the Unity Editor process. |
Use unity_execute_csharp to read or modify scene state, selected objects, Console output, project metadata, and assets with C# snippets.
Unity Editor code can expose custom project tools by marking static methods with AgentToolAttribute.
New custom tools are discovered in Edit → Project Settings → DotCraft → Unity Tools, default to disabled.
using System.ComponentModel;
using DotCraft.Editor.Protocol;
using DotCraft.Editor.RuntimeTools;
public static class ExampleDotCraftTools
{
[Description("Return a greeting from an example Unity plugin.")]
[AgentTool(Namespace = "example", Name = "example_greet", Kind = AcpToolKind.Read)]
public static object Greet([Description("Name to greet.")] string name = "Unity")
{
return new { message = $"Hello, {name}." };
}
}See Documentation~/dynamic-tools.md for more details.
dotcraft-unity provides a shared automation skill for external agents and a direct ACP integration for DotCraft.
The repository publishes the same Unity automation skill as both a DotCraft plugin and a Codex plugin. Configure the MCP Gateway separately in Unity so an installed plugin can call the tools covered by the skill.
For DotCraft:
- Open Plugins in DotCraft.
- Open the menu beside Create, then select Add marketplace.
- Enter
DotHarness/dotcraft-unityas the marketplace source. - Add the marketplace, then install DotCraft Unity.
For Codex, add DotHarness/dotcraft-unity as a plugin marketplace, then install DotCraft Unity from that marketplace.
When using DotCraft as the ACP server, you do not need an MCP service. Built-in tools and custom tools are passed to the session through ACP extensions, reducing context overhead for non-Unity sessions.
Apache License 2.0



