Skip to content

Fix object identity APIs for Unity 6.4 and newer - #1136

Merged
keveleigh merged 3 commits into
MixedRealityToolkit:mainfrom
gdgeek:codex/fix-unity-6-entity-ids
Sep 24, 2026
Merged

keveleigh merged 3 commits into
MixedRealityToolkit:mainfrom
gdgeek:codex/fix-unity-6-entity-ids

Conversation

@gdgeek

@gdgeek gdgeek commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Unity 6.6 reports CS0619 for Object.GetInstanceID(), preventing the Input and SpatialManipulation editor assemblies from compiling.

Use GetEntityId() on Unity 6.4 and newer while retaining GetInstanceID() on earlier editors. Controller mapping validation stores full EntityId values, including EntityId.None for empty or missing references, so duplicate detection retains its existing behavior without narrowing IDs to int. The constraint manager label and the "Go to component" highlight query both use the same ID API.

Fixes #1134.

Validation

  • Reproduced the three existing CS0619 errors using Unity 6000.6.0f1's bundled compiler and the affected editor assembly response files.
  • Compiled both complete affected editor assemblies with the patched files against Unity 6000.6.0f1 editor assemblies: passed.
  • Compiled both affected editor assemblies against Unity 6000.4.12f1 editor assemblies using its bundled compiler: passed.
  • Forced the legacy preprocessor branches and compiled both affected assemblies against Unity 6000.4.12f1: passed.
  • git diff --check: passed.

The direct compiler checks use existing MRTK dependency assemblies. They do not replace interactive Inspector checks, a full project migration, or device testing. Unity versions earlier than 6.4 were not installed for execution; their original code paths are preserved.

@gdgeek
gdgeek requested a review from a team as a code owner September 23, 2026 13:52
@keveleigh

Copy link
Copy Markdown
Contributor

Looks good to me! Will pull it down and test it out.

One note: please add changelog entries for these!

WARNING: Package 'org.mixedrealitytoolkit.input' has changes, but its CHANGELOG.md was not updated. This is not always an issue but usually is
WARNING: Package 'org.mixedrealitytoolkit.spatialmanipulation' has changes, but its CHANGELOG.md was not updated. This is not always an issue but usually is

@keveleigh

Copy link
Copy Markdown
Contributor

@gdgeek I went ahead and:

  1. Added changelog entries
  2. Updated some related calls in FindObjectUtility which were also newly deprecated in 6.4 due to the entity ID change

Hope that's okay! Running a few more local tests, then I'll merge

@keveleigh
keveleigh enabled auto-merge (squash) September 24, 2026 22:58
@keveleigh
keveleigh merged commit acdec2d into MixedRealityToolkit:main Sep 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Unity 6000.5 compilation fails because GetInstanceID is an obsolete error

2 participants