fix-unity-console

A Unity Editor command that reads console errors, warnings, and assertions, then coordinates fixes through UnityMCP. Unity is a tool for building games and other interactive applications.

In plain words
What is it for?
Use it to investigate and fix Unity compilation errors, null-reference errors, missing script references, and obsolete API warnings.
Why use it?
It turns a noisy console into grouped problems and checks whether fixes worked by reimporting assets or recompiling scripts. It also reports issues that still need manual attention.

Command for Claude Code

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 commands/akiojin/unity-editor-mcp/fix-unity-console
Clone the repo
git clone --depth 1 https://github.com/akiojin/unity-editor-mcp

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,392 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.00000 $0.01392
Opus 5 $0.00000 $0.00696
Sonnet 5 $0.00000 $0.00278
Haiku 4.5 $0.00000 $0.00139

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

Security

Grade A, and why

fix-unity-console 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/commands/fix-unity-console.md · 165 lines

How it starts

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

/FixUnityConsole

Unityエディタのコンソール出力を確認し、エラーや警告を自動的に解決するコマンド

概要

このコマンドは、UnityMCPを利用してUnityエディタのコンソールログを取得・分析し、unity-architectが複数の専門サブエージェントに作業を分配して問題を並列で解決します。エラーの種類に応じて適切なサブエージェントが専門的な修正を実行します。

処理フロー

  1. Unity Editor接続確認

    • UnityMCPへの接続確認
    • エディタの実行状態確認
    • 接続エラー時の診断と対処法の提示
  2. コンソールログ収集

    • エラー、警告、アサートを取得
    • タイムスタンプ順にソート
    • 重複するエラーをグループ化
  3. Unity側での再検証

    • アセットの再インポート
    • スクリプトの再コンパイル
    • エラーが解消されたことを確認
  4. 作業完了報告

    • 修正内容のサマリー
    • 残存する問題の報告
    • 手動対応が必要な項目の提示

エラータイプ別の対処法

コンパイルエラー

// エラー例: CS0246: 型または名前空間の名前 'Vector3' が見つかりませんでした
// 修正: using UnityEngine; を追加

Null参照例外

// エラー例: NullReferenceException: Object reference not set to an instance of an object
// 修正: null チェックの追加
if (component != null) {
    component.DoSomething();
}

Missing参照

// エラー例: The referenced script on this Behaviour is missing!
// 修正:
// 1. スクリプトファイルを検索
// 2. GameObjectのコンポーネントを更新
// 3. プレハブを再保存

非推奨API

// エラー例: 'Application.LoadLevel' is obsolete
// 修正: SceneManager.LoadScene に置換

実装詳細

Unity接続確認

# UnityMCPの接続テスト
mcp__UnityMCP__ping

# エディタ状態の確認
mcp__UnityMCP__get_editor_state

ログ取得と分析

# エラーログの取得
mcp__UnityMCP__enhanced_read_logs --logTypes Error --count 100

# コンパイル状態の確認
mcp__UnityMCP__get_compilation_state

修正できない問題の処理

  • プロジェクト設定の問題
  • 外部アセットの互換性
  • プラットフォーム固有の問題
  • ライセンス関連のエラー

出力例

成功時の出力:

/FixUnityConsole

🔍 Unity Editorに接続中...
  ✅ 接続成功
  📊 エディタ状態: Play Mode

📋 コンソールログを取得中...
  ⚠️ 警告: 15件
  ❌ エラー: 8件
  🔴 アサート: 2件

🏗️ unity-architectが問題を分析中...
  コンパイルエラー: 3件
  Null参照例外: 2件
  Missing参照: 3件

🔄 Unityで再コンパイル中...
  ✅ コンパイル成功

📊 最終結果:
  修正済み: 8/8 エラー(5つのサブエージェントによる並列処理)
  処理時間: 通常の1/5に短縮
  残存エラー: 0件

✅ すべてのエラーが解決されました!

エラー時の出力:

/FixUnityConsole

🔍 Unity Editorに接続中...
  ❌ 接続失敗

⚠️ Unity Editorが起動していないか、UnityMCPが正しく設定されていません。

🔧 対処法:
  1. Unity Editorが起動していることを確認
  2. UnityMCPの設定を確認:
     - .mcp.jsonでUnityMCPが有効になっているか
     - ポート番号が正しいか(デフォルト: 5001)
  3. Unity側でMCPパッケージがインポートされているか確認

📖 詳細なセットアップ手順:
  https://github.com/your-repo/unity-mcp-setup

Read the full file on GitHub · 165 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 · 165 lines · 0 tokens per session scan A 63da118387b1

Subscribe to this mod's changes

fix-unity-console is a command published in the GitHub repository akiojin/unity-editor-mcp (11 stars, last pushed 12mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,392 tokens. 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.