Skip to content

Commit ed2def1

Browse files
committed
docs(execute_code): correct the compiler description now that Roslyn comes from Unity
The description promised C# 12+ and told callers Microsoft.CodeAnalysis had to be installed. Neither holds once the editor's own Roslyn is loaded: nothing needs installing, and that copy is 3.11, which caps the language at C# 9. Reference page regenerated with tools/generate_docs_reference.py; it is the only page that changed.
1 parent cb8932b commit ed2def1

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎Server/src/services/tools/execute_code.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"Actions: execute (run code), get_history (list past executions), "
2727
"replay (re-run a history entry), clear_history. "
2828
"NOTE: safety_checks blocks known dangerous patterns but is not a full sandbox. "
29-
"Compiler options: 'auto' (Roslyn if available, else CodeDom), 'roslyn' (C# 12+, requires Microsoft.CodeAnalysis), 'codedom' (C# 6 only)."
29+
"Compiler options: 'auto' and 'roslyn' both use the Roslyn that ships with Unity (C# 9); 'codedom' forces the legacy provider (C# 6 only)."
3030
),
3131
group="scripting_ext",
3232
annotations=ToolAnnotations(
@@ -61,8 +61,8 @@ async def execute_code(
6161
compiler: Annotated[
6262
Literal["auto", "roslyn", "codedom"],
6363
"Compiler backend for 'execute' action. "
64-
"'auto' uses Roslyn if Microsoft.CodeAnalysis is installed, else falls back to CodeDom. "
65-
"'roslyn' forces Roslyn (C# 12+). 'codedom' forces legacy CSharpCodeProvider (C# 6). Default: auto.",
64+
"'auto' and 'roslyn' both load the Roslyn shipped with the editor, which caps the language at C# 9. "
65+
"'codedom' forces the legacy CSharpCodeProvider (C# 6). Default: auto.",
6666
] = "auto",
6767
) -> dict[str, Any]:
6868
unity_instance = await get_unity_instance_from_context(ctx)

‎website/docs/reference/tools/scripting_ext/execute_code.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ description: "Execute arbitrary C# code inside the Unity Editor."
1212

1313
## Description
1414

15-
Execute arbitrary C# code inside the Unity Editor. The code runs as a method body with access to UnityEngine and UnityEditor namespaces. Use 'return' to send data back. Compiled in-memory — no script files created. Actions: execute (run code), get_history (list past executions), replay (re-run a history entry), clear_history. NOTE: safety_checks blocks known dangerous patterns but is not a full sandbox. Compiler options: 'auto' (Roslyn if available, else CodeDom), 'roslyn' (C# 12+, requires Microsoft.CodeAnalysis), 'codedom' (C# 6 only).
15+
Execute arbitrary C# code inside the Unity Editor. The code runs as a method body with access to UnityEngine and UnityEditor namespaces. Use 'return' to send data back. Compiled in-memory — no script files created. Actions: execute (run code), get_history (list past executions), replay (re-run a history entry), clear_history. NOTE: safety_checks blocks known dangerous patterns but is not a full sandbox. Compiler options: 'auto' and 'roslyn' both use the Roslyn that ships with Unity (C# 9); 'codedom' forces the legacy provider (C# 6 only).
1616

1717
## Parameters
1818

@@ -23,7 +23,7 @@ Execute arbitrary C# code inside the Unity Editor. The code runs as a method bod
2323
| `safety_checks` | `bool` | — | Enable basic blocked-pattern checks (File.Delete, Process.Start, infinite loops, etc). Not a full sandbox — advanced bypass is possible. Default: true. |
2424
| `index` | `int \| None` | — | History entry index to replay (for 'replay' action). |
2525
| `limit` | `int` | — | Number of history entries to return (for 'get_history' action, 1-50). Default: 10. |
26-
| `compiler` | `Literal['auto', 'roslyn', 'codedom']` | — | Compiler backend for 'execute' action. 'auto' uses Roslyn if Microsoft.CodeAnalysis is installed, else falls back to CodeDom. 'roslyn' forces Roslyn (C# 12+). 'codedom' forces legacy CSharpCodeProvider (C# 6). Default: auto. |
26+
| `compiler` | `Literal['auto', 'roslyn', 'codedom']` | — | Compiler backend for 'execute' action. 'auto' and 'roslyn' both load the Roslyn shipped with the editor, which caps the language at C# 9. 'codedom' forces the legacy CSharpCodeProvider (C# 6). Default: auto. |
2727

2828
## Returns
2929

0 commit comments

Comments
 (0)