Skip to content

Backport MCP for Unity v10.3.0 to Unity 2020.3 LTS - #1497

Closed
akhilkalyani wants to merge 2 commits into
CoplayDev:mainfrom
akhilkalyani:unity-2020.3
Closed

akhilkalyani wants to merge 2 commits into
CoplayDev:mainfrom
akhilkalyani:unity-2020.3

Conversation

@akhilkalyani

Copy link
Copy Markdown

Port the Unity package (MCPForUnity) so it compiles and runs on Unity 2020.3 (C# 8, .NET 4.x profile). The Python server is unchanged (mcpforunityserver==10.3.0).

  • Rewrite C# 9 syntax to C# 8: target-typed new(), is not patterns, or/and patterns, target-typed conditionals, ranges.
  • Replace .NET Standard 2.1 APIs missing from 2020.3 with Editor/Compat/NetCompat.cs (string overloads, Math.Clamp, Path.GetRelativePath, ProcessStartInfo.ArgumentList, PBKDF2-SHA256).
  • Guard Unity 2021+ editor APIs behind UNITY_2021_2/2021_3_OR_NEWER with 2020.3 fallbacks; add stand-ins for DropdownField, NamedBuildTarget, StandaloneBuildSubtarget and PackageInfo.GetAllRegisteredPackages.
  • Runtime UI Toolkit actions of manage_ui return a clear error on 2020.3.
  • Drop the com.unity.nuget.newtonsoft-json dependency (conflicts with jillejr Newtonsoft packages), reference the TestRunner assemblies explicitly, and disable upstream update prompts.
  • Add UNITY-2020.3.md and tools/unity-2020.3-backport (compile check, C# 9->8 rewriter, tarball packer).

Description

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Test update

Changes Made

Compatibility / Package Source

  • Unity version(s) tested:
  • Package source used (#beta, #main, tag, branch, or file:):
  • Resolved commit hash from Packages/packages-lock.json (if using a Git package URL):

Testing/Screenshots/Recordings

  • Python tests (cd Server && uv run pytest tests/ -v)
  • Unity EditMode tests
  • Unity PlayMode tests
  • Package import/compile check
  • Not applicable (explain why in Additional Notes)

Documentation Updates

  • I have added/removed/modified tools or resources
  • If yes, I have updated all documentation files using:
    • The LLM prompt at tools/UPDATE_DOCS_PROMPT.md (recommended)
    • Manual review of the generated changes

Related Issues

Additional Notes

Port the Unity package (MCPForUnity) so it compiles and runs on Unity
2020.3 (C# 8, .NET 4.x profile). The Python server is unchanged
(mcpforunityserver==10.3.0).

- Rewrite C# 9 syntax to C# 8: target-typed new(), `is not` patterns,
  or/and patterns, target-typed conditionals, ranges.
- Replace .NET Standard 2.1 APIs missing from 2020.3 with
  Editor/Compat/NetCompat.cs (string overloads, Math.Clamp,
  Path.GetRelativePath, ProcessStartInfo.ArgumentList, PBKDF2-SHA256).
- Guard Unity 2021+ editor APIs behind UNITY_2021_2/2021_3_OR_NEWER with
  2020.3 fallbacks; add stand-ins for DropdownField, NamedBuildTarget,
  StandaloneBuildSubtarget and PackageInfo.GetAllRegisteredPackages.
- Runtime UI Toolkit actions of manage_ui return a clear error on 2020.3.
- Drop the com.unity.nuget.newtonsoft-json dependency (conflicts with
  jillejr Newtonsoft packages), reference the TestRunner assemblies
  explicitly, and disable upstream update prompts.
- Add UNITY-2020.3.md and tools/unity-2020.3-backport (compile check,
  C# 9->8 rewriter, tarball packer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a1a72699-3070-4db7-9e24-c9b8ffdc37ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Unity 2020.3 does not reliably call CreateGUI again for an EditorWindow
restored after a domain reload, so an already-open MCP window (or one
whose first CreateGUI failed) stayed blank and the menu only re-focused it.

- MCP window: build the UI from OnEnable (delayCall), OnFocus and
  ShowWindow when it is missing, and replace a leftover window whose UI
  was never built with a fresh one.
- Setup and EditorPrefs windows: rebuild from OnEnable when empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant