unity-csharp-editing

Guidance and tools for editing, searching, and refactoring Unity C# scripts. It includes code indexing, symbol lookup, reference searches, and small or structured code edits.

In plain words
What is it for?
Use it to build or check a code index, read symbols, find references, create classes, add methods, refactor scripts, and follow a TDD cycle, meaning writing tests alongside the code they check.
Why use it?
It helps an assistant find the right classes and methods before changing code, reducing the need to search through scripts manually.

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/akiojin/unity-mcp-server/unity-csharp-editing
Any agent
npx skills add akiojin/unity-mcp-server --skill unity-csharp-editing
Clone the repo
git clone --depth 1 https://github.com/akiojin/unity-mcp-server

Made for: Claude Code, Codex.

Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,887 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.00060 $0.02887
Opus 5 $0.00030 $0.01443
Sonnet 5 $0.00012 $0.00577
Haiku 4.5 $0.00006 $0.00289

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

Security

Grade A, and why

unity-csharp-editing 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.

.claude-plugin/plugins/unity-mcp-server/skills/unity-csharp-editing/SKILL.md · 448 lines

How it starts

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

Unity C# Script Editing

A guide for efficient editing, searching, and refactoring of Unity C# scripts.

Quick Start

1. Initialize Code Index

On first use or when the index is outdated, build the index first:

// Check index status
mcp__unity-mcp-server__get_index_status()

// Build index (first time only, may take a few minutes)
mcp__unity-mcp-server__build_index()

2. Basic Reading Flow

// Get symbol list in file
mcp__unity-mcp-server__get_symbols({
  path: "Assets/Scripts/Player.cs"
})

// Get specific symbol details
mcp__unity-mcp-server__find_symbol({
  name: "PlayerController",
  kind: "class",
  exact: true
})

// Read code
mcp__unity-mcp-server__read({
  path: "Assets/Scripts/Player.cs",
  startLine: 10,
  endLine: 50
})

3. Basic Editing Flow

// Small changes (within 80 characters) → snippet
mcp__unity-mcp-server__edit_snippet({
  path: "Assets/Scripts/Player.cs",
  instructions: [{
    operation: "replace",
    anchor: { type: "text", target: "if (health < 0)" },
    newText: "if (health <= 0)"
  }]
})

// Large changes (method body) → structured
mcp__unity-mcp-server__edit_structured({
  path: "Assets/Scripts/Player.cs",
  symbolName: "PlayerController/TakeDamage",
  operation: "replace_body",
  newText: "{\n    health -= damage;\n    OnDamaged?.Invoke(damage);\n}"
})

Core Concepts

Code Index

unity-mcp-server provides a code index via built-in C# LSP. Output is 5x more compact than standard tools, optimizing LLM context.

Tool Purpose Comparison
find_symbol Symbol search 5x smaller output
find_refs Reference search 3x smaller output
search Code search Instant response

namePath (Symbol Path)

Symbols are identified by hierarchical path within file:

// Simple class
PlayerController

// Nested member
PlayerController/TakeDamage
PlayerController/health

// Deep nesting
OuterClass/InnerClass/Method

Read the full file on GitHub · 448 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 · 448 lines · 0 tokens per session scan A 5f0da31c75d8

Subscribe to this mod's changes

unity-csharp-editing is a skill published in the GitHub repository akiojin/unity-mcp-server (34 stars, last pushed 9d ago), licensed MIT. It adds 60 tokens to every session and 2,887 once invoked, about $0.0003 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

stage-tamagotchi-godot-csharp

Apply engine-local C# development method and code style only when working in engines/stage-tamagotchi-godot, including its .cs files, .csproj, engine-local .editorconfig, and Godot-specific C# structure decisions. Do not use for TypeScript, Electron, renderer code, shared workspace config, repo-wide C# conventions, or…

moeru-ai/airi · 103 tokens

reflection-method-find

Find C# methods across every loaded assembly by name / type / parameters — including private methods. Returns serialized MethodData entries usable as schemas for 'reflection-method-call'.

IvanMurzak/Unity-MCP · 39 tokens

unity

Compile, test, and drive Unity for this repo's C# packages (unity/core, jint, quickjs, clearscript) and the two Unity projects (tests/, kitchen-sink/). Use when a change touches C# under unity/, when Unity test results are needed, when a rendering snapshot has to be checked or regenerated, or when the app has to be…

ReactUnity/core · 108 tokens

godot-csharp

Use C#/.NET in Godot 4.7: partial classes extending nodes, the PascalCase lifecycle (Ready/Process/PhysicsProcess), [Export] fields, [Signal] delegates as C# events, type-safe node lookup, and calling between C# and GDScript. Use when writing Godot game code in C# (.cs files, .csproj), needing the Godot .NET build…

gamedev-skills/awesome-gamedev-agent-skills · 108 tokens

unity-csharp-scripting

Write Unity 6.3 LTS C# gameplay scripts: the MonoBehaviour lifecycle (Awake/OnEnable/Start/Update/FixedUpdate/LateUpdate), GameObject and component access, coroutines, and Inspector serialization. Use when creating or editing .cs scripts in a Unity project, or when the user mentions MonoBehaviour, Start/Update…

gamedev-skills/awesome-gamedev-agent-skills · 92 tokens

uloop-hot-reload

Hot reload applies method-body edits and can add new methods and fields (added members are visible only to edited code in the same file); it can also change signatures when the same reload covers the old signature's compiled callers. New types, or members other files must reference, require 'uloop compile'.

hatayama/unity-cli-loop · 66 tokens