Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: CoplayDev/unity-mcp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v9.0.8
Choose a base ref
...
head repository: CoplayDev/unity-mcp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v9.1.0
Choose a head ref
  • 18 commits
  • 71 files changed
  • 13 contributors

Commits on Jan 19, 2026

  1. fix: Add Prefab Stage support for GameObject lookup (#573)

    * Enhance Prefab Stage support in GameObject lookup and scene management
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    
    * fix: unify path matching and restore fast path lookup
    
    ---------
    
    Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
    cyanxwh and claude authored Jan 19, 2026
    Configuration menu
    Copy the full SHA
    e617753 View commit details
    Browse the repository at this point in the history
  2. fix: search inactive objects when setActive=true in modify (#581)

    When trying to activate an inactive GameObject via manage_gameobject modify with setActive=true, the lookup would fail because inactive objects were not included in the search by default.
    
    Now automatically sets searchInactive=true when setActive=true is specified, allowing inactive objects to be found and activated.
    dsarno authored Jan 19, 2026
    Configuration menu
    Copy the full SHA
    8252e6d View commit details
    Browse the repository at this point in the history
  3. fix: Filter EditorApplication.isCompiling false positives in Play mode (

    #582)
    
    EditorApplication.isCompiling can return true in Play mode even when Unity
    is not actually compiling, causing MCP tools to incorrectly return
    "busy/compiling" errors.
    
    This adds a GetActualIsCompiling() helper that double-checks with
    CompilationPipeline.isCompiling via reflection when in Play mode to filter
    out these false positives.
    
    Fixes #549
    dsarno authored Jan 19, 2026
    Configuration menu
    Copy the full SHA
    f4e441c View commit details
    Browse the repository at this point in the history
  4. docs: Streamline README for faster onboarding (#583)

    * docs: Streamline README for faster onboarding
    
    Major restructuring to reduce README from ~500 lines to ~200 lines while preserving all essential information.
    
    Changes:
    - Add prominent "Quick Start" section at top with prerequisites and 5-step setup
    - Highlight Git package URL with GitHub TIP admonition for visibility
    - Collapse detailed content into expandable sections:
      - Features & Tools
      - Manual Configuration (with nested stdio legacy config)
      - Multiple Unity Instances
      - Roslyn Script Validation
      - Troubleshooting
      - Contributing
      - Telemetry & Privacy
    - Keep Star History and Coplay sections always visible
    - Condense tools/resources from verbose lists to compact bullet format
    - Add step 5 for client connection (toggle for Cursor/Windsurf/Antigravity)
    
    The goal is 1-2 screens of visible content for new users to get started quickly,
    with all details accessible via dropdowns for those who need them.
    
    * docs: Address review feedback
    
    - Add `text` language identifier to Git URL code blocks for linter compliance
    - Clarify step 5 client connection instructions with clearer categorization
    - Add nested dropdown for manual Roslyn DLL installation option
    
    * docs: Indent nested Roslyn manual installation dropdown
    
    * docs: Add wiki links to Troubleshooting section
    dsarno authored Jan 19, 2026
    Configuration menu
    Copy the full SHA
    0158165 View commit details
    Browse the repository at this point in the history
  5. fix: Add special handling for UIDocument serialization to prevent inf…

    …inite loops (#586)
    
    * fix: search inactive objects when setActive=true in modify
    
    When trying to activate an inactive GameObject via manage_gameobject modify with setActive=true, the lookup would fail because inactive objects were not included in the search by default.
    
    Now automatically sets searchInactive=true when setActive=true is specified, allowing inactive objects to be found and activated.
    
    * fix: Add special handling for UIDocument serialization to prevent infinite loops (#585)
    
    UIDocument.rootVisualElement contains circular parent/child references that
    can cause infinite serialization loops. This adds special handling similar to
    Transform and Camera components.
    
    The fix:
    - Safely serializes panelSettings, visualTreeAsset, sortingOrder, enabled, parentUI
    - Explicitly skips rootVisualElement to prevent circular reference issues
    - Includes a note explaining why rootVisualElement is skipped
    
    Tested on Unity 2021.3 and Unity 6.3.
    
    * refactor: Extract SerializeAssetReference helper and align UIDocument structure
    
    - Add SerializeAssetReference() helper for consistent asset reference serialization
    - UIDocument now uses same return structure as Camera (typeName, instanceID, properties)
    - Reduces code duplication in special-case handlers
    - Enhanced test coverage to verify structure matches Camera pattern
    
    * fix: Handle UIDocument subclasses and add negative assertion for rootVisualElement
    
    Address code review feedback:
    - Add IsOrDerivedFrom() helper to detect UIDocument and any subclasses by walking
      the base-type chain, ensuring derived types also get special-case handling
    - Add negative assertion verifying rootVisualElement is NOT in serialized output
    dsarno authored Jan 19, 2026
    Configuration menu
    Copy the full SHA
    aaf6308 View commit details
    Browse the repository at this point in the history

Commits on Jan 21, 2026

  1. Configuration menu
    Copy the full SHA
    5d26862 View commit details
    Browse the repository at this point in the history
  2. Fix blog post URL in README

    Corrected the URL in the blog post reference.
    JosvanderWesthuizen authored Jan 21, 2026
    Configuration menu
    Copy the full SHA
    cd10472 View commit details
    Browse the repository at this point in the history
  3. fix: comprehensive performance optimizations, claude code config, an…

    …d stability improvements (issue #577) (#595)
    
    * fix: reduce per-frame GC allocations causing editor hitches (issue #577)
    
    Eliminate memory allocations that occurred every frame, which triggered
    garbage collection spikes (~28ms) approximately every second.
    
    Changes:
    - EditorStateCache: Skip BuildSnapshot() entirely when state unchanged
      (check BEFORE building). Increased poll interval from 0.25s to 1.0s.
      Cache DeepClone() results to avoid allocations on GetSnapshot().
    
    - TransportCommandDispatcher: Early exit before lock/list allocation
      when Pending.Count == 0, eliminating per-frame allocations when idle.
    
    - StdioBridgeHost: Same early exit pattern for commandQueue.
    
    - MCPForUnityEditorWindow: Throttle OnEditorUpdate to 2-second intervals
      instead of every frame, preventing expensive socket checks 60+/sec.
    
    Fixes GitHub issue #577: High performance impact even when MCP server is off
    
    * fix: prevent multiple domain reloads when calling refresh_unity (issue #577)
    
    Root Cause:
    - send_command() had a hardcoded retry loop (min 6 attempts) on connection errors
    - Each retry resent the refresh_unity command, causing Unity to reload 6 times
    - retry_on_reload=False only controlled reload-state retries, not connection retries
    
    The Fix:
    1. Unity C# (MCPForUnity/Editor):
       - Added --reinstall flag to uvx commands in dev mode
       - Ensures local development changes are picked up by uvx/Claude Code
       - Applies to all client configurators (Claude Code, Codex, etc.)
    
    2. Python Server (Server/src):
       - Added max_attempts parameter to send_command()
       - Pass max_attempts=0 when retry_on_reload=False
       - Fixed type handling in refresh_unity.py (handle MCPResponse objects)
       - Added timeout to connection error recovery conditions
       - Recovery logic now returns success instead of error to prevent client retries
    
    Changes:
    - MCPForUnity/Editor: Added --reinstall to dev mode uvx commands
    - Server/refresh_unity.py: Fixed type handling, improved error recovery
    - Server/unity_connection.py: Added max_attempts param, disable retries when retry_on_reload=False
    
    Result: refresh_unity with compile=request now triggers only 1 domain reload instead of 6
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    
    * fix: UI and server stability improvements
    
    Unity Editor (C#):
    - Fix "Resuming..." stuck state when manually clicking End Session
      Clear ResumeStdioAfterReload and ResumeHttpAfterReload flags in
      OnConnectionToggleClicked and EndOrphanedSessionAsync to prevent
      UI from getting stuck showing "Resuming..." with disabled button
    - Remove unsupported --reinstall flag from all uvx command builders
      uvx does not support --reinstall and shows warning when used
      Use --no-cache --refresh instead for dev mode cache busting
    
    Python Server:
    - Add "aborted" to connection error patterns in refresh_unity
      Handle WinError 10053 (connection aborted) gracefully during
      Unity domain reload, treating it as expected behavior
    - Add WindowsSafeRotatingFileHandler to suppress log rotation errors
      Windows file locking prevents log rotation when file is open by
      another process; catch PermissionError to avoid noisy stack traces
    - Fix packaging: add py-modules = ["main"] to pyproject.toml
      setuptools.packages.find only discovers packages (directories with
      __init__.py), must explicitly list standalone module files
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    
    * docs: improve refresh_unity connection loss handling documentation
    
    Add detailed comments and logging to clarify why connection loss during
    compile is treated as success (expected domain reload behavior, not failure).
    This addresses PR feedback about potentially masking real connection errors.
    
    The logic is intentional and correct:
    - Connection loss only treated as success when compile='request'
    - Domain reload causing disconnect is expected Unity behavior
    - Subsequent wait_for_ready loop validates Unity becomes ready
    - Prevents multiple domain reload loops (issue #577)
    
    Added logging for observability:
    - Info log when expected disconnect detected
    - Warning log for non-recoverable errors
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    
    * fix: add missing logger import in refresh_unity
    
    Missing logger import causes NameError at runtime when connection
    loss handling paths are triggered (lines 82 and 91).
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    
    * fix: address code review feedback on thread safety and semantics
    
    Addresses four issues raised in code review:
    
    1. EditorStateCache.GetSnapshot() - Remove shared cached clone
       - Revert to always returning fresh DeepClone() to prevent mutation bugs
       - Main GC optimization remains: state-change detection prevents
         unnecessary _cached rebuilds (the expensive operation)
       - Removed _cachedClone and _cachedCloneSequence fields
    
    2. refresh_unity.py - Fix blocking reason terminology mismatch
       - Changed "asset_refresh" to "asset_import" to match activityPhase
         values from EditorStateCache.cs
       - Ensures asset import is correctly detected as blocking state
    
    3. TransportCommandDispatcher - Fix unsynchronized Count access
       - Moved Pending.Count check inside PendingLock
       - Prevents data races and InvalidOperationException from concurrent
         dictionary access
    
    4. StdioBridgeHost - Fix unsynchronized Count access
       - Moved commandQueue.Count check inside lockObj
       - Ensures all collection access is properly serialized
    
    All changes maintain the GC allocation optimizations while fixing
    thread safety violations and semantic contract changes.
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    
    * fix: address code review feedback on thread safety and timeout handling
    
    - refresh_unity.py: Track readiness explicitly and return failure on timeout
      instead of silently returning success when wait loop exits without confirming
      ready_for_tools=true
    
    - McpClientConfiguratorBase.cs: Add thread safety guard for Configure() call
      in CheckStatusWithProjectDir(). Changed default attemptAutoRewrite to false
      and added runtime check to prevent calling Configure() from background threads.
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    
    ---------
    
    Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
    dsarno and claude authored Jan 21, 2026
    Configuration menu
    Copy the full SHA
    8eb684d View commit details
    Browse the repository at this point in the history
  4. Create pull_request_template.md

    Add a pull request template for contributors.
    Scriptwonder authored Jan 21, 2026
    Configuration menu
    Copy the full SHA
    d96dad3 View commit details
    Browse the repository at this point in the history
  5. Project scoped tools (#596)

    * feat: Add project-scoped tools flag to control custom tool registration behavior
    
    Add `--project-scoped-tools` CLI flag and `UNITY_MCP_PROJECT_SCOPED_TOOLS` environment variable to control whether custom tools are registered globally or scoped to specific Unity projects.
    
    Closes #416
    
    * Add .meta file
    
    * feat: Add project-scoped tools toggle for local HTTP transport
    
    Add UI toggle in Connection section to control project-scoped tools flag when using HTTP Local transport. The toggle:
    - Defaults to enabled (true)
    - Persists state in EditorPrefs
    - Only displays when HTTP Local transport is selected
    - Automatically appends `--project-scoped-tools` flag to uvx server command
    - Updates manual config display when toggled
    
    * Update Server/src/services/custom_tool_service.py
    
    Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
    
    * Pass project_scoped_tools flag directly without environment variable conversion
    
    Remove unnecessary environment variable conversion for project_scoped_tools flag.
    
    * fix: Improve error handling and logging in global custom tool registration
    
    Split exception handling to distinguish between expected RuntimeError (service not initialized) and unexpected errors.
    
    ---------
    
    Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
    msanatan and sourcery-ai[bot] authored Jan 21, 2026
    Configuration menu
    Copy the full SHA
    b69ee80 View commit details
    Browse the repository at this point in the history
  6. Update README with citation (#591)

    * Update README with citation and AI tools information
    
    Added citation for research and details about Unity AI tools.
    
    * Update README.md spacing
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Marcus Sanatan <msanatan@gmail.com>
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    3 people authored Jan 21, 2026
    Configuration menu
    Copy the full SHA
    d2408f0 View commit details
    Browse the repository at this point in the history
  7. use localhost to ping server if server binds to 0.0.0.0 (#542)

    Co-authored-by: vladimir.ivanov <terakriper@gmail.com>
    kripergvg and vladimir.ivanov authored Jan 21, 2026
    Configuration menu
    Copy the full SHA
    abd596f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    1cc5826 View commit details
    Browse the repository at this point in the history
  9. Minor fixes (#602)

    * Log a message with implicit URI changes
    
    Small update for #542
    
    * Log a message with implicit URI changes
    
    Small update for #542
    
    * Add helper scripts to update forks
    
    * fix: improve HTTP Local URL validation UX and styling specificity
    
    - Rename CSS class from generic "error" to "http-local-url-error" for better specificity
    - Rename "invalid-url" class to "http-local-invalid-url" for clarity
    - Disable httpServerCommandField when URL is invalid or transport not HTTP Local
    - Clear field value and tooltip when showing validation errors
    - Ensure field is re-enabled when URL becomes valid
    msanatan authored Jan 21, 2026
    Configuration menu
    Copy the full SHA
    810d756 View commit details
    Browse the repository at this point in the history
  10. Docker mcp gateway (#603)

    * Log a message with implicit URI changes
    
    Small update for #542
    
    * Update docker container to default to stdio
    
    Replaces #541
    msanatan authored Jan 21, 2026
    Configuration menu
    Copy the full SHA
    1ad4f09 View commit details
    Browse the repository at this point in the history
  11. fix: Rider config path and add MCP registry manifest (#604)

    - Fix RiderConfigurator to use correct GitHub Copilot config path:
      - Windows: %LOCALAPPDATA%\github-copilot\intellij\mcp.json
      - macOS: ~/Library/Application Support/github-copilot/intellij/mcp.json
      - Linux: ~/.config/github-copilot/intellij/mcp.json
    - Add mcp.json for GitHub MCP Registry support:
      - Enables users to install via coplaydev/unity-mcp
      - Uses uvx with mcpforunityserver from PyPI
    dsarno authored Jan 21, 2026
    Configuration menu
    Copy the full SHA
    f54b1cb View commit details
    Browse the repository at this point in the history

Commits on Jan 22, 2026

  1. Add CLI (#606)

    * feat: Add CLI for Unity MCP server
    
    - Add click-based CLI with 15+ command groups
    - Commands: gameobject, component, scene, asset, script, editor, prefab, material, lighting, ui, audio, animation, code
    - HTTP transport to communicate with Unity via MCP server
    - Output formats: text, json, table
    - Configuration via environment variables or CLI options
    - Comprehensive usage guide and unit tests
    
    * Update based on AI feedback
    
    * Fixes main.py error
    
    * Update for further error fix
    
    * Update based on AI
    
    * Update script.py
    
    * Update with better coverage and Tool Readme
    
    * Log a message with implicit URI changes
    
    Small update for #542
    
    * Minor fixes (#602)
    
    * Log a message with implicit URI changes
    
    Small update for #542
    
    * Log a message with implicit URI changes
    
    Small update for #542
    
    * Add helper scripts to update forks
    
    * fix: improve HTTP Local URL validation UX and styling specificity
    
    - Rename CSS class from generic "error" to "http-local-url-error" for better specificity
    - Rename "invalid-url" class to "http-local-invalid-url" for clarity
    - Disable httpServerCommandField when URL is invalid or transport not HTTP Local
    - Clear field value and tooltip when showing validation errors
    - Ensure field is re-enabled when URL becomes valid
    
    * Docker mcp gateway (#603)
    
    * Log a message with implicit URI changes
    
    Small update for #542
    
    * Update docker container to default to stdio
    
    Replaces #541
    
    * fix: Rider config path and add MCP registry manifest (#604)
    
    - Fix RiderConfigurator to use correct GitHub Copilot config path:
      - Windows: %LOCALAPPDATA%\github-copilot\intellij\mcp.json
      - macOS: ~/Library/Application Support/github-copilot/intellij/mcp.json
      - Linux: ~/.config/github-copilot/intellij/mcp.json
    - Add mcp.json for GitHub MCP Registry support:
      - Enables users to install via coplaydev/unity-mcp
      - Uses uvx with mcpforunityserver from PyPI
    
    * Use click.echo instead of print statements
    
    * Standardize whitespace
    
    * Minor tweak in docs
    
    * Use `wait` params
    
    * Unrelated but project scoped tools should be off by default
    
    * Update lock file
    
    * Whitespace cleanup
    
    * Update custom_tool_service.py to skip global registration for any tool name that already exists as a built‑in.
    
    * Avoid silently falling back to the first Unity session when a specific unity_instance was requested but not found.
    
    If a client passes a unity_instance that doesn’t match any session, this code will still route the command to the first available session, which can send commands to the wrong project in multi‑instance environments. Instead, when a unity_instance is provided but no matching session_id is found, return an error (e.g. 400/404 with "Unity instance '' not found") and only default to the first session when no unity_instance was specified.
    
    Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
    
    * Update docs/CLI_USAGE.md
    
    Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
    
    * Updated the CLI command registration to only swallow missing optional modules and to surface real import-time failures, so broken command modules don’t get silently ignored.
    
    * Sorted __all__ alphabetically to satisfy RUF022 in __init__.py.
    
    * Validate --params is a JSON object before merging.
    
    Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Shutong Wu <51266340+Scriptwonder@users.noreply.github.com>
    Co-authored-by: dsarno <david@lighthaus.us>
    Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
    Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
    5 people authored Jan 22, 2026
    Configuration menu
    Copy the full SHA
    7f44e4b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3ef2d37 View commit details
    Browse the repository at this point in the history
Loading