Fix compile errors on Unity 6000.5 (CS0619) and 6000.6 (UAC1016) - #6
Open
lordborden wants to merge 2 commits into
Open
Fix compile errors on Unity 6000.5 (CS0619) and 6000.6 (UAC1016)#6lordborden wants to merge 2 commits into
lordborden wants to merge 2 commits into
Conversation
Unity 6000.5 marks SerializedProperty.objectReferenceInstanceIDValue and Object.GetInstanceID() obsolete-as-error (CS0619), breaking compilation of MapImporterEditor. Switch to the EntityId replacements the obsolete messages recommend, guarded with UNITY_6000_5_OR_NEWER so the package still compiles on the older Unity versions it supports (package min 2022.3). Verified: a headless compile of a Unity 6000.5.4f1 project against this fork exits 0 with zero compile errors.
Unity 6000.6 promotes its script-serialization rules to compiler
diagnostics. GenericDictionary's two private lookup fields are marked
[SerializeField, HideInInspector], which now trips UAC1016 as a hard
error and stops the package compiling:
GenericDictionary.cs(22,39): error UAC1016: Field 'indexByKey' uses
dictionary type 'Dictionary<TKey, int>' whose key type 'TKey' is
not serializable.
GenericDictionary.cs(24,42): error UAC1016: Field 'dict' ... (x2)
Those attributes were never doing anything: Unity has no Dictionary<,>
serialization support on any version, so no YAML was ever emitted for
these fields. Only 'list' is serialized, and OnAfterDeserialize rebuilds
both lookups from it. Mark them [NonSerialized] to state that intent and
keep the analyzer satisfied.
Because the attributes were inert, this is behavior-preserving on every
Unity version and needs no #if guard: serialized layout is unchanged, so
existing assets/prefabs/scenes keep round-tripping identically.
Verified against Unity 6000.6.0f1: a headless batchmode compile of a
project consuming this package exits 0 with zero errors. Reverting just
this commit in the same project reproduces exactly the three UAC1016
errors above, confirming this change is what clears them.
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.
Two independent compile errors block Scopa on current Unity releases. Both fixes are small and backward-compatible.
1. Unity 6000.5 —
CS0619inMapImporterEditorUnity 6000.5 promotes two APIs from obsolete-warning to obsolete-as-error (CS0619):
SerializedProperty.objectReferenceInstanceIDValueObject.GetInstanceID()Fix: switch to the
EntityIdreplacements Unity's own obsolete messages recommend, guarded so older editors keep the existing path.2. Unity 6000.6 —
UAC1016inGenericDictionaryUnity 6000.6 promotes its script-serialization rules to compiler diagnostics.
GenericDictionary's two private lookup fields are marked[SerializeField, HideInInspector], which now fails the build outright:Fix: mark them
[NonSerialized].Those attributes were never doing anything. Unity has no
Dictionary<,>serialization support on any version, so no YAML was ever emitted for these two fields — onlylistis serialized, andOnAfterDeserializerebuilds both lookups from it. The change just states that existing intent explicitly.Compatibility
Neither fix changes behavior on the Unity versions Scopa already supports (package min 2022.3):
#if UNITY_6000_5_OR_NEWER; older editors compile the original line..asset/.prefab/.unityfiles keep round-tripping identically, and no reimport or migration is required.Testing
Headless batchmode compiles of throwaway projects consuming this branch as a local package:
On 6000.6.0f1 I also ran the negative control: reverting only the
GenericDictionarycommit reproduces exactly the threeUAC1016errors above and fails the build, confirming that change is what clears them.The 6000.6 build additionally emits two pre-existing
UAC1002warnings (ScopaEntityData's Sledge base classesEntity/MapObjectlack[Serializable]). Those are warnings, not errors, they predate this PR, and fixing them means editing the vendoredSledge.Formatssource — so I've deliberately left them out of scope here. Happy to open a separate PR if you'd like them addressed.