executing-csharp-scripts-in-unity-editor

A Unity Editor workflow for running C# scripts and checking console logs or Unity tests.

In plain words
What is it for?
Use it to modify GameObjects, components, prefabs, ScriptableObjects, and scenes; inspect console errors; and run EditMode or PlayMode tests.
Why use it?
It provides a defined way to change scenes and Unity objects, debug editor state, and verify source-code changes.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/signal-loop/unitycodemcpserver/executing-csharp-scripts-in-unity-editor
Any agent
npx skills add Signal-Loop/UnityCodeMCPServer --skill executing-csharp-scripts-in-unity-editor
Clone the repo
git clone --depth 1 https://github.com/Signal-Loop/UnityCodeMCPServer

Made for: Claude Code, Codex.

Per session 95 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,461 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00095 $0.03461
Opus 5 $0.00048 $0.01731
Sonnet 5 $0.00019 $0.00692
Haiku 4.5 $0.00010 $0.00346

Measured 2d ago against content hash 196e65ee8bdd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

executing-csharp-scripts-in-unity-editor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/executing-csharp-scripts-in-unity-editor/SKILL.md · 310 lines

How it starts

The opening of the file, as written. The whole thing — 310 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Executing C# Scripts in Unity Editor

Table of Contents

  1. Available Tools
  2. Core Principles
  3. Forbidden Patterns
  4. Usage Workflow
  5. Debugging Loop
  6. Favourite Scripts
  7. Script Context and APIs
  8. Common Scripting Patterns

Available Tools

This skill coordinates three tools within one workflow. Use the tool that matches the task, and combine them when the task crosses from source edits to Editor automation or test verification.

Tool Purpose When to Use
execute_csharp_script_in_unity_editor Executes C# code in the live Unity Editor (Roslyn) Modifying scenes, GameObjects, Components, Prefabs, ScriptableObjects, or running Editor automation. Script output and logs are returned directly in the tool result.
read_unity_console_logs Reads recent entries from the Unity Editor Console Before executing an Editor script or Unity test when the task depends on compiled C# code. Also useful when debugging unexpected Editor state.
run_unity_tests Runs EditMode or PlayMode Unity tests via TestRunnerApi After editing C# source files to verify logic correctness. Do not use it for ad-hoc code execution, and do not run it solely because an Editor script was executed.

Execute C# Script Tool Contract

Use execute_csharp_script_in_unity_editor for live Unity Editor work:

Read the full file on GitHub · 310 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 310 lines · 95 tokens per session scan A 196e65ee8bdd

Subscribe to this mod's changes

executing-csharp-scripts-in-unity-editor is a skill published in the GitHub repository Signal-Loop/UnityCodeMCPServer (19 stars, last pushed 1mo ago), licensed MIT. It adds 95 tokens to every session and 3,461 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

assets-get-data

Get asset data from the asset file in the Unity project — every serializable field and property. Supports token-saving path-scoped reads via paths or viewQuery. Use 'assets-find' to find the asset first.

IvanMurzak/Unity-MCP · 50 tokens

gameobject-component-destroy

Destroy one or more Components from a target GameObject. Missing (null) components are skipped — they cannot be destroyed. Use 'gameobject-find' and 'gameobject-component-get' to identify the components first.

IvanMurzak/Unity-MCP · 49 tokens

gameobject-set-parent

Reparent a batch of GameObjects under a new parent in the currently opened Prefab or active Scene. Per-item failures are reported in the returned status string instead of aborting the batch. Use 'gameobject-find' to locate the GameObjects first.

IvanMurzak/Unity-MCP · 56 tokens

assets-create-folder

Create a new folder under a parent folder inside 'Assets/'. The parent path must start with 'Assets/' and every intermediate folder in it must already exist. Refreshes the AssetDatabase at the end and returns the GUID(s) of the created folder(s).

IvanMurzak/Unity-MCP · 55 tokens

console-get-logs

Retrieve Unity Editor logs from the MCP plugin's LogCollector, optionally filtered by log type or time window. Useful for debugging and monitoring Editor activity.

IvanMurzak/Unity-MCP · 35 tokens

assets-prefab-save

Save the currently opened prefab edit stage back to its prefab asset without exiting the stage. Pair with 'assets-prefab-open' to enter the edit mode first.

IvanMurzak/Unity-MCP · 37 tokens