fix: Unity 6.5 projects compile without metadata type conflicts - #1377
Merged
Conversation
Unity 6000.5 now references System.Reflection.Metadata during editor compilation, so the package must not import the bundled metadata validation dependencies there. Keep explicit-reference protection for older Unity versions and add metadata coverage.
Contributor
📝 WalkthroughWalkthroughA new constant ChangesMetadata validation dependency define constraint test
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1370
Summary
User Impact
Changes
Verification
uloop compile --force-recompile true --wait-for-domain-reload truenpm --prefix Packages/src/Cli~ run test:cli -- --runTestsByPath src/__tests__/package-metadata.test.tsnpm --prefix Packages/src/Cli~ run lintnpm --prefix Packages/src/Cli~ run buildcodex review --commit HEADSummary
This PR fixes compilation failures in Unity CLI Loop when building with Unity 6.5 (version 6000.5 and newer) that were present in versions 2.1.8 and 2.1.9.
Problem
The bundled metadata validation dependency packages caused CS0433 errors (duplicate metadata type conflicts) when compiling with Unity 6000.5 and newer, which now includes its own
System.Reflection.Metadatareference during editor compilation.Solution
The fix excludes bundled metadata validation dependencies from Unity 6000.5+ through Unity define constraints, while maintaining explicit-reference importer settings for older Unity versions to prevent accidental implicit references. Package metadata coverage is added to document and enforce the exclusion.
Changes
Packages/src/Cli~/src/tests/package-metadata.test.ts
METADATA_VALIDATION_DEPENDENCY_DEFINE_CONSTRAINT = '!UNITY_6000_5_OR_NEWER'!UNITY_6000_5_OR_NEWERdefine constraintThe test verifies the define constraint is properly configured in the three bundled dependency .meta files to ensure they are excluded when compiling with Unity 6000.5 and newer versions.
Verification
The fix has been verified through: