Skip to content

Fix compilation for Unity 6000.5#66

Open
piti6 wants to merge 1 commit into
Unity-Technologies:mainfrom
piti6:fix/unity-6000.5-support
Open

Fix compilation for Unity 6000.5#66
piti6 wants to merge 1 commit into
Unity-Technologies:mainfrom
piti6:fix/unity-6000.5-support

Conversation

@piti6

@piti6 piti6 commented Jul 6, 2026

Copy link
Copy Markdown

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 behind UNITY_6000_5_OR_NEWER).

What broke and how it is fixed

6000.5 change Fix
Non-generic IMGUI TreeView / TreeViewItem / TreeViewState are obsolete (error) Alias them to the generic TreeView<int> family on 6000.5+ in the Collections views (the generic API mirrors the old one, including the internal controller property accessed via reflection)
PropertyTable is obsolete (error, "IMGUI is not supported anymore") Stop compiling DependencyTableViewIMGUI on 6000.5+. It is dead code there: DependencyViewer.CreateTableView only instantiates it below 2023.1, where DependencyTableViewUITk takes over
ISearchView gained a string currentResultViewId { get; set; } member Implemented in SearchViewModelEx and SearchViewElement (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), GlobalObjectId int-based helpers, and the EntityId -> int implicit conversion are obsolete (error) Migrated to the EntityId-based equivalents on 6000.5+. Where an Object overload already existed (GetGlobalObjectIdSlow, PingObject), it is now used unconditionally, which works on all supported versions

Note on the EntityId migration

EntityId.ToString() returns the raw 64-bit value (magic version in the upper 32 bits), so EntityId values cannot be dropped into the dependency query strings (deps{[...]}) that previously carried int instance ids. Since both the producer (DependencyBuiltinStates) and the consumer (the deps search expression evaluator) live in this package, the int wire format is kept on 6000.5 by extracting the lower 32 bits via the non-obsolete EntityId.ToULong() (same value the removed implicit int conversion produced).

Testing

Compiled projects/SearchExtensionsExamples (which pulls in package, package-examples, and package-queries) in batch mode:

  • 6000.5.2f1 — 0 compile errors (was ~20 before this change)
  • 6000.4.3f1 — still compiles (all changes are #if-gated)
  • 2022.3.62f2 — still compiles

🤖 Generated with Claude Code

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>
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.

1 participant