Skip to content

Patch-Fix-04-26#1084

Merged
Scriptwonder merged 2 commits intoCoplayDev:betafrom
Scriptwonder:chore/issue-fixes-2026-04-26
Apr 27, 2026
Merged

Patch-Fix-04-26#1084
Scriptwonder merged 2 commits intoCoplayDev:betafrom
Scriptwonder:chore/issue-fixes-2026-04-26

Conversation

@Scriptwonder
Copy link
Copy Markdown
Collaborator

@Scriptwonder Scriptwonder commented Apr 27, 2026

Patch for several issues mentioned in the repo:

  1. fix(为什么addpacakge会报错? #1068): block NuGet System.CodeDom conflict via
    overrideReferences
  2. fix(Unity 6.6 Alpha (6000.6.0a2): CS0619 compile errors in UnityTypeConverters.cs and GameObjectLookup.cs #1062): add reflection branch for Unity 6.6 InstanceIDToObject
    deprecation
  3. refactor: merge EditorObjectResolver into UnityObjectIdCompat
  4. fix(get_IsEnabled hits EditorPrefs.GetBool from ThreadPool (not main thread) — UnityException in TransportCommandDispatcher continuation #1065): cache McpLogRecord.IsEnabled to allow ThreadPool reads
  5. fix(opencode.json configuration does not support stdio transport — defaults to HTTP #1070): emit stdio entry from OpenCodeConfigurator
  6. fix: rewrite localhost→127.0.0.1 in NormalizeBaseUrl (supersedes
    Replace localhost with 127.0.0.1 for correct Codex handshake #1057)

Summary by CodeRabbit

  • New Features

    • MCP server configuration now auto-detects and validates based on current transport (stdio or remote).
  • Bug Fixes

    • Improved handling of localhost addresses in local endpoint normalization.
  • Performance

    • Optimized logging performance through preference caching to reduce repeated lookups.
  • Chores

    • Internal refactoring to consolidate compatibility helpers and improve code organization.

  1. fix(CoplayDev#1068): block NuGet System.CodeDom conflict via
  overrideReferences
  2. fix(CoplayDev#1062): add reflection branch for Unity 6.6 InstanceIDToObject
  deprecation
  3. refactor: merge EditorObjectResolver into UnityObjectIdCompat (could
  squash into prev)
  4. fix(CoplayDev#1065): cache McpLogRecord.IsEnabled to allow ThreadPool reads
  5. fix(CoplayDev#1070): emit stdio entry from OpenCodeConfigurator
  6. fix: rewrite localhost→127.0.0.1 in NormalizeBaseUrl (supersedes
  CoplayDev#1057)
Copilot AI review requested due to automatic review settings April 27, 2026 01:14
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

📝 Walkthrough

Walkthrough

These changes refactor MCP server configuration detection to support multiple transport types (stdio/local and remote HTTP), consolidate instance ID compatibility helpers into a shared utility class, optimize repeated preference lookups with caching, normalize localhost addresses to IPv4, and adjust assembly reference overrides.

Changes

Cohort / File(s) Summary
Transport-aware Server Configuration
MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs
Adds transport detection and conditional server entry generation: stdio/local mode builds command-array entries with uvx path and stdio flag; remote mode uses HTTP RPC URL. Introduces EntryMatchesCurrentTransport for validating config type against current transport. Throws InvalidOperationException if uvx is missing for stdio mode.
Instance ID Compatibility Consolidation
MCPForUnity/Runtime/Helpers/UnityObjectIdCompat.cs, MCPForUnity/Runtime/Helpers/UnityObjectIdCompatExtensions.cs, MCPForUnity/Editor/Helpers/GameObjectLookup.cs, MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs
Moves instance ID compatibility logic from extension class to new static utility; adds reflection-based fallback for newer Unity versions. Updates callers to use centralized InstanceIDToObjectCompat method instead of conditional compilation branches.
URL Normalization
MCPForUnity/Editor/Helpers/HttpEndpointUtility.cs
Adds local-scope normalization to replace localhost with 127.0.0.1 in absolute URLs, ensuring unambiguous IPv4 loopback representation in stored/emitted base URLs.
Performance Optimization
MCPForUnity/Editor/Helpers/McpLogRecord.cs
Caches IsEnabled preference value in volatile field and initializes via InitializeOnLoadMethod hook instead of querying EditorPrefs on every get; setter updates both cache and preferences.
Assembly Configuration
MCPForUnity/Editor/MCPForUnity.Editor.asmdef
Changes overrideReferences flag from false to true to alter reference binding behavior for editor assembly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 The rabbit hops through transports swift,
From stdio streams to HTTP drift,
IDs unified, caches bright,
localhost becomes 127.0.0.1 just right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description lists the six specific fixes and refactoring efforts with issue references, but does not follow the provided template structure with required sections like Type of Change, Changes Made, Testing, and Documentation Updates. Reorganize the description to match the template: add a Type of Change section, expand Changes Made with details, include Testing section, and verify Documentation Updates if applicable.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Patch-Fix-04-26' is generic and does not convey meaningful information about the specific changes, using only a date-stamp format without describing the main purpose or impact. Replace the title with a descriptive summary of the primary change or main fix, such as 'Add reflection support for Unity 6.6 and cache performance improvements' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs (1)

153-160: ⚠️ Potential issue | 🟡 Minor

GetManualSnippet will surface raw InvalidOperationException to UI.

BuildServerEntry() now throws when uvx isn't found, but GetManualSnippet() has no try/catch. Per McpClientConfigSection.UpdateManualConfiguration(), this call site has no error handling either, so a missing uvx in stdio mode will throw straight into the UI when the user opens the manual config panel — producing a red-error popup instead of a usable message in the snippet field. Configure() already handles this by setting McpStatus.Error; the snippet path needs the same defensiveness.

🛡️ Suggested fix
 public override string GetManualSnippet()
 {
-    var snippet = new JObject
-    {
-        ["mcp"] = new JObject { [ServerName] = BuildServerEntry() }
-    };
-    return JsonConvert.SerializeObject(snippet, Formatting.Indented);
+    try
+    {
+        var snippet = new JObject
+        {
+            ["mcp"] = new JObject { [ServerName] = BuildServerEntry() }
+        };
+        return JsonConvert.SerializeObject(snippet, Formatting.Indented);
+    }
+    catch (InvalidOperationException ex)
+    {
+        return $"// Unable to build snippet: {ex.Message}";
+    }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs` around
lines 153 - 160, GetManualSnippet should not let BuildServerEntry's
InvalidOperationException bubble to the UI; wrap the call to BuildServerEntry()
in a try/catch for InvalidOperationException and, on catch, return a serialized
snippet JSON that contains a clear error placeholder (e.g.
["mcp"][ServerName]["error"] = ex.Message) instead of rethrowing; this mirrors
how Configure() sets McpStatus.Error and prevents the raw exception from
producing a red popup in the manual config panel.
🧹 Nitpick comments (2)
MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs (1)

209-222: Consider validating stdio command contents, not just shape.

For remote entries you compare the URL to the expected GetMcpRpcUrl(), but for stdio you only check that command is a JArray. If the configured command array is stale (e.g. wrong uvx path, missing --transport stdio, different package name), CheckStatus will report Configured and skip the auto-rewrite branch. A lightweight check (e.g. comparing element[0] to the resolved uvx path or asserting --transport/stdio are present) would keep the symmetry with the remote path.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs` around
lines 209 - 222, EntryMatchesCurrentTransport currently only checks that
entry["command"] is a JArray for stdio transports; extend this to validate the
command contents to avoid stale configs: when expected ==
ConfiguredTransport.Stdio, ensure entry["command"] is a JArray with at least one
element where element[0] equals the resolved uvx executable path (use your
existing helper that resolves the uvx executable) and that the array contains
the transport flags (e.g. a "--transport" arg followed by "stdio" or a single
"--transport=stdio" token); keep the other return semantics and still use
LocalType for the type check and UrlsEqual for the remote case.
MCPForUnity/Runtime/Helpers/UnityObjectIdCompat.cs (1)

53-69: Reflection fallback design is intentional; consider a Debug.LogWarning for diagnostics (optional).

The InstanceIDToObject(int) API is documented as remaining at runtime on 6.6+ (only obsolete-as-error at compile time), and the reflection approach is explicitly designed to bypass the compile-time check. The null-safe ?.Invoke already handles the case where the method is not found, and both GameObjectLookup.ResolveInstanceID and UnityTypeConverters include their own null-result handling.

If you add a one-time Debug.LogWarning when _instanceIdToObject == null (as shown in the original diff), it would help distinguish "API removed from runtime" from "instance ID stale" on future Unity versions, though both currently produce the same null result by design.

♻️ Suggested fix (optional)
 `#if` UNITY_6000_6_OR_NEWER
             if (!_instanceIdToObjectInitialized)
             {
                 _instanceIdToObject = typeof(EditorUtility).GetMethod(
                     "InstanceIDToObject",
                     BindingFlags.Public | BindingFlags.Static,
                     null,
                     new[] { typeof(int) },
                     null);
                 _instanceIdToObjectInitialized = true;
+                if (_instanceIdToObject == null)
+                {
+                    Debug.LogWarning("[UnityObjectIdCompat] EditorUtility.InstanceIDToObject(int) not found via reflection; instance-ID resolution will return null on this Unity version.");
+                }
             }
             return _instanceIdToObject?.Invoke(null, new object[] { instanceId }) as Object;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@MCPForUnity/Runtime/Helpers/UnityObjectIdCompat.cs` around lines 53 - 69, In
UnityObjectIdCompat, when using reflection to find
EditorUtility.InstanceIDToObject (check _instanceIdToObject and
_instanceIdToObjectInitialized), add a one-time Debug.LogWarning if the
reflected method (_instanceIdToObject) is null after initialization so callers
can distinguish "method missing at runtime" from a stale instance ID; implement
this by detecting _instanceIdToObject == null immediately after the GetMethod
call and logging a clear one-time warning (use the same
_instanceIdToObjectInitialized flag to ensure it only logs once) while leaving
the existing null-safe ?.Invoke behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@MCPForUnity/Editor/Helpers/HttpEndpointUtility.cs`:
- Around line 339-348: The current localhost branch replaces the host by
building a new Uri and then calls builder.Uri.GetLeftPart(UriPartial.Authority),
which drops any path/query (so "http://localhost:8080/api?x=1" becomes
"http://127.0.0.1:8080"); instead, after creating the UriBuilder (and keeping
the remoteScope check and Uri.TryCreate logic), preserve the original
parsed.PathAndQuery when composing trimmed — e.g. use the authority from
builder.Uri combined with parsed.PathAndQuery (or otherwise append the original
path/query) so only the host is swapped and any path/query remains intact;
update the assignment to trimmed accordingly and ensure it still participates in
the existing NormalizeBaseUrl trailing-slash/path trimming logic.

---

Outside diff comments:
In `@MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs`:
- Around line 153-160: GetManualSnippet should not let BuildServerEntry's
InvalidOperationException bubble to the UI; wrap the call to BuildServerEntry()
in a try/catch for InvalidOperationException and, on catch, return a serialized
snippet JSON that contains a clear error placeholder (e.g.
["mcp"][ServerName]["error"] = ex.Message) instead of rethrowing; this mirrors
how Configure() sets McpStatus.Error and prevents the raw exception from
producing a red popup in the manual config panel.

---

Nitpick comments:
In `@MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs`:
- Around line 209-222: EntryMatchesCurrentTransport currently only checks that
entry["command"] is a JArray for stdio transports; extend this to validate the
command contents to avoid stale configs: when expected ==
ConfiguredTransport.Stdio, ensure entry["command"] is a JArray with at least one
element where element[0] equals the resolved uvx executable path (use your
existing helper that resolves the uvx executable) and that the array contains
the transport flags (e.g. a "--transport" arg followed by "stdio" or a single
"--transport=stdio" token); keep the other return semantics and still use
LocalType for the type check and UrlsEqual for the remote case.

In `@MCPForUnity/Runtime/Helpers/UnityObjectIdCompat.cs`:
- Around line 53-69: In UnityObjectIdCompat, when using reflection to find
EditorUtility.InstanceIDToObject (check _instanceIdToObject and
_instanceIdToObjectInitialized), add a one-time Debug.LogWarning if the
reflected method (_instanceIdToObject) is null after initialization so callers
can distinguish "method missing at runtime" from a stale instance ID; implement
this by detecting _instanceIdToObject == null immediately after the GetMethod
call and logging a clear one-time warning (use the same
_instanceIdToObjectInitialized flag to ensure it only logs once) while leaving
the existing null-safe ?.Invoke behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 462996db-1960-45b6-93d9-9eafced4df0f

📥 Commits

Reviewing files that changed from the base of the PR and between 3adb569 and 996ccd1.

📒 Files selected for processing (10)
  • MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs
  • MCPForUnity/Editor/Helpers/GameObjectLookup.cs
  • MCPForUnity/Editor/Helpers/HttpEndpointUtility.cs
  • MCPForUnity/Editor/Helpers/McpLogRecord.cs
  • MCPForUnity/Editor/MCPForUnity.Editor.asmdef
  • MCPForUnity/Runtime/Helpers/UnityObjectIdCompat.cs
  • MCPForUnity/Runtime/Helpers/UnityObjectIdCompat.cs.meta
  • MCPForUnity/Runtime/Helpers/UnityObjectIdCompatExtensions.cs
  • MCPForUnity/Runtime/Helpers/UnityObjectIdCompatExtensions.cs.meta
  • MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs
💤 Files with no reviewable changes (2)
  • MCPForUnity/Runtime/Helpers/UnityObjectIdCompatExtensions.cs.meta
  • MCPForUnity/Runtime/Helpers/UnityObjectIdCompatExtensions.cs

Comment on lines +339 to +348
// For local scope, force 127.0.0.1 over "localhost". Windows getaddrinfo returns ::1
// first; clients without Happy Eyeballs (e.g., Codex/reqwest) hit the v6 socket while
// our server binds v4-only, breaking the handshake. The default server bind is
// 127.0.0.1, so emitting the literal v4 keeps every client unambiguous.
if (!remoteScope && Uri.TryCreate(trimmed, UriKind.Absolute, out Uri parsed)
&& string.Equals(parsed.Host, "localhost", StringComparison.OrdinalIgnoreCase))
{
var builder = new UriBuilder(parsed) { Host = "127.0.0.1" };
trimmed = builder.Uri.GetLeftPart(UriPartial.Authority);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Path/query silently dropped when host is localhost.

GetLeftPart(UriPartial.Authority) strips everything after the authority, so a stored value like http://localhost:8080/api would be rewritten to http://127.0.0.1:8080, while the same URL with a non-localhost host on lines 319-337 keeps its path intact. This is an inconsistent normalization. Since NormalizeBaseUrl is designed for base URLs (and already strips /mcp/trailing slashes), this is likely fine in practice, but consider preserving any remaining path for symmetry, e.g. only swapping the host:

♻️ Suggested fix to preserve path/query during host swap
-            if (!remoteScope && Uri.TryCreate(trimmed, UriKind.Absolute, out Uri parsed)
-                && string.Equals(parsed.Host, "localhost", StringComparison.OrdinalIgnoreCase))
-            {
-                var builder = new UriBuilder(parsed) { Host = "127.0.0.1" };
-                trimmed = builder.Uri.GetLeftPart(UriPartial.Authority);
-            }
+            if (!remoteScope && Uri.TryCreate(trimmed, UriKind.Absolute, out Uri parsed)
+                && string.Equals(parsed.Host, "localhost", StringComparison.OrdinalIgnoreCase))
+            {
+                var builder = new UriBuilder(parsed) { Host = "127.0.0.1" };
+                trimmed = builder.Uri.AbsoluteUri.TrimEnd('/');
+            }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// For local scope, force 127.0.0.1 over "localhost". Windows getaddrinfo returns ::1
// first; clients without Happy Eyeballs (e.g., Codex/reqwest) hit the v6 socket while
// our server binds v4-only, breaking the handshake. The default server bind is
// 127.0.0.1, so emitting the literal v4 keeps every client unambiguous.
if (!remoteScope && Uri.TryCreate(trimmed, UriKind.Absolute, out Uri parsed)
&& string.Equals(parsed.Host, "localhost", StringComparison.OrdinalIgnoreCase))
{
var builder = new UriBuilder(parsed) { Host = "127.0.0.1" };
trimmed = builder.Uri.GetLeftPart(UriPartial.Authority);
}
// For local scope, force 127.0.0.1 over "localhost". Windows getaddrinfo returns ::1
// first; clients without Happy Eyeballs (e.g., Codex/reqwest) hit the v6 socket while
// our server binds v4-only, breaking the handshake. The default server bind is
// 127.0.0.1, so emitting the literal v4 keeps every client unambiguous.
if (!remoteScope && Uri.TryCreate(trimmed, UriKind.Absolute, out Uri parsed)
&& string.Equals(parsed.Host, "localhost", StringComparison.OrdinalIgnoreCase))
{
var builder = new UriBuilder(parsed) { Host = "127.0.0.1" };
trimmed = builder.Uri.AbsoluteUri.TrimEnd('/');
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@MCPForUnity/Editor/Helpers/HttpEndpointUtility.cs` around lines 339 - 348,
The current localhost branch replaces the host by building a new Uri and then
calls builder.Uri.GetLeftPart(UriPartial.Authority), which drops any path/query
(so "http://localhost:8080/api?x=1" becomes "http://127.0.0.1:8080"); instead,
after creating the UriBuilder (and keeping the remoteScope check and
Uri.TryCreate logic), preserve the original parsed.PathAndQuery when composing
trimmed — e.g. use the authority from builder.Uri combined with
parsed.PathAndQuery (or otherwise append the original path/query) so only the
host is swapped and any path/query remains intact; update the assignment to
trimmed accordingly and ensure it still participates in the existing
NormalizeBaseUrl trailing-slash/path trimming logic.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR delivers a set of compatibility and configuration patches across the Unity package, addressing Unity 6.6 API deprecations, editor assembly reference conflicts, logging thread-safety, and client configuration generation.

Changes:

  • Add a unified InstanceID/EntityId compatibility helper (including a Unity 6.6 reflection path) and route editor-side instance resolution through it.
  • Update editor compilation behavior to avoid NuGet System.CodeDom type conflicts and make log-record enablement safe to read from ThreadPool continuations.
  • Improve client/config endpoint generation by normalizing local localhost to 127.0.0.1 and emitting an OpenCode stdio configuration entry when the server transport is stdio.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs Switches instanceID deserialization lookup to UnityObjectIdCompat.InstanceIDToObjectCompat.
MCPForUnity/Runtime/Helpers/UnityObjectIdCompatExtensions.cs.meta Removes meta for the old compat extension file (part of rename/move).
MCPForUnity/Runtime/Helpers/UnityObjectIdCompatExtensions.cs Removes the old compat extension implementation (replaced by new unified helper).
MCPForUnity/Runtime/Helpers/UnityObjectIdCompat.cs.meta Adds meta for the new unified compat helper (retaining GUID).
MCPForUnity/Runtime/Helpers/UnityObjectIdCompat.cs Introduces GetInstanceIDCompat and editor-only InstanceIDToObjectCompat with Unity 6.6 reflection fallback.
MCPForUnity/Editor/MCPForUnity.Editor.asmdef Enables overrideReferences to avoid reference collisions (e.g., System.CodeDom).
MCPForUnity/Editor/Helpers/McpLogRecord.cs Caches IsEnabled via an editor-load refresh to avoid ThreadPool EditorPrefs reads.
MCPForUnity/Editor/Helpers/HttpEndpointUtility.cs Normalizes local base URLs by rewriting localhost127.0.0.1.
MCPForUnity/Editor/Helpers/GameObjectLookup.cs Uses UnityObjectIdCompat.InstanceIDToObjectCompat for instance ID resolution.
MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs Emits a stdio-capable OpenCode server entry and validates config against the current transport.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

&& string.Equals(parsed.Host, "localhost", StringComparison.OrdinalIgnoreCase))
{
var builder = new UriBuilder(parsed) { Host = "127.0.0.1" };
trimmed = builder.Uri.GetLeftPart(UriPartial.Authority);
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NormalizeBaseUrl currently rewrites localhost by rebuilding the URI and then assigning trimmed = builder.Uri.GetLeftPart(UriPartial.Authority). This drops any existing path/query/fragment, which is inconsistent with the rest of the function (it only strips a trailing /mcp) and can change behavior only for localhost inputs (e.g., http://localhost:8080/foo becomes http://127.0.0.1:8080). Consider normalizing to the authority for all parsed URLs (to match the method’s doc comment), or preserve the original path when rewriting the host so the transformation is host-only.

Suggested change
trimmed = builder.Uri.GetLeftPart(UriPartial.Authority);
trimmed = builder.Uri.ToString().TrimEnd('/');

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +50
/// <summary>
/// Resolves an int instance ID handle back to a UnityEngine.Object.
/// Pre-6.0 : EditorUtility.InstanceIDToObject(int)
/// 6.0–6.5 : EditorUtility.EntityIdToObject(int) (implicit int→EntityId cast)
/// 6.6+ : reflection on InstanceIDToObject(int) — the API still exists at runtime
/// but is obsolete-as-error; reflection bypasses CS0619 until the public
/// EntityId(int) ctor stabilizes.
/// </summary>
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version notes in this XML doc don’t match the actual compile-time gates below: the EntityIdToObject(int) path is behind UNITY_6000_3_OR_NEWER, so Unity 6.0–6.2 would still use InstanceIDToObject(int). Please update the comment to reflect the real version ranges used by the #if blocks so future changes don’t rely on incorrect assumptions.

Copilot uses AI. Check for mistakes.
@Scriptwonder Scriptwonder merged commit 2e93b69 into CoplayDev:beta Apr 27, 2026
5 checks passed
@Scriptwonder Scriptwonder deleted the chore/issue-fixes-2026-04-26 branch April 27, 2026 01:22
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.

2 participants