Fix compilation for Unity 6000.5#66
Open
piti6 wants to merge 1 commit into
Open
Conversation
Unity 6000.5 turned several APIs into compile errors: - IMGUI TreeView/TreeViewItem/TreeViewState are obsolete(error): alias them to the generic TreeView<int> family on 6000.5+. - PropertyTable is obsolete(error): stop compiling DependencyTableViewIMGUI on 6000.5+ (it is only instantiated below 2023.1, where DependencyTableViewUITk takes over). - ISearchView grew a currentResultViewId member: implement it in SearchViewModelEx and SearchViewElement. - Object.GetInstanceID, EditorUtility.InstanceIDToObject, AssetDatabase.GetAssetPath(int), EditorGUIUtility.PingObject(int), GlobalObjectId int-based helpers and the EntityId->int implicit conversion are obsolete(error): migrate to the EntityId-based equivalents behind UNITY_6000_5_OR_NEWER, using EntityId.ToULong to keep the legacy int wire format for dependency queries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
The packages no longer compile with Unity 6000.5 (tested with 6000.5.2f1): several APIs that were previously deprecated became compile errors (
[Obsolete(..., error: true)]). This PR fixes compilation for 6000.5 while keeping the existing behavior on older versions (everything is gated behindUNITY_6000_5_OR_NEWER).What broke and how it is fixed
TreeView/TreeViewItem/TreeViewStateare obsolete (error)TreeView<int>family on 6000.5+ in theCollectionsviews (the generic API mirrors the old one, including the internalcontrollerproperty accessed via reflection)PropertyTableis obsolete (error, "IMGUI is not supported anymore")DependencyTableViewIMGUIon 6000.5+. It is dead code there:DependencyViewer.CreateTableViewonly instantiates it below 2023.1, whereDependencyTableViewUITktakes overISearchViewgained astring currentResultViewId { get; set; }memberSearchViewModelExandSearchViewElement(explicit implementation with a backing field — the member is internal, so an implicit implementation does not compile under C# 9)Object.GetInstanceID(),EditorUtility.InstanceIDToObject(int),AssetDatabase.GetAssetPath(int)/OpenAsset(int),EditorGUIUtility.PingObject(int),GlobalObjectIdint-based helpers, and theEntityId -> intimplicit conversion are obsolete (error)EntityId-based equivalents on 6000.5+. Where anObjectoverload already existed (GetGlobalObjectIdSlow,PingObject), it is now used unconditionally, which works on all supported versionsNote on the
EntityIdmigrationEntityId.ToString()returns the raw 64-bit value (magic version in the upper 32 bits), soEntityIdvalues cannot be dropped into the dependency query strings (deps{[...]}) that previously carried int instance ids. Since both the producer (DependencyBuiltinStates) and the consumer (thedepssearch expression evaluator) live in this package, the int wire format is kept on 6000.5 by extracting the lower 32 bits via the non-obsoleteEntityId.ToULong()(same value the removed implicitintconversion produced).Testing
Compiled
projects/SearchExtensionsExamples(which pulls inpackage,package-examples, andpackage-queries) in batch mode:#if-gated)🤖 Generated with Claude Code