Execute Code
execute_codeExecute C# code in Unity Editor instantly via Roslyn, bypassing recompilation. Restricts access to file, network, and process APIs, and auto-wraps bare statements for quick iteration.
Instructions
Execute C# code in Unity Editor via Roslyn. 10-40x faster than recompile. Security: no System.IO, System.Net, System.Diagnostics. Bare statements are auto-wrapped in a static class — no boilerplate needed. Example: "var go = new GameObject("Test"); return go.name;"
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "execute_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | C# code to execute in the Unity Editor context | |
| undo_label | No | Label for the Undo group entry (default 'execute_code') | execute_code |