Fixed Unity 6000.4 methods that have been marked as obsolete
This commit is contained in:
parent
230a976a52
commit
612a8504cd
3 changed files with 26 additions and 2 deletions
|
|
@ -1,6 +1,12 @@
|
|||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [2.0.3] - 2026-03-31
|
||||
|
||||
### Fixed
|
||||
- Fixed Unity 6000.4 methods that have been marked as obsolete
|
||||
|
||||
|
||||
## [2.0.2] - 2025-12-15
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
|
|
@ -41,9 +41,18 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
private static void OnDropdownOpen(Rect rect)
|
||||
{
|
||||
var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
|
||||
|
||||
#if UNITY_6000_4_OR_NEWER
|
||||
var canvases = prefabStage != null
|
||||
? prefabStage.prefabContentsRoot.GetComponentsInParent<Canvas>()
|
||||
: Object.FindObjectsByType<Canvas>(FindObjectsInactive.Include);
|
||||
|
||||
System.Array.Sort(canvases, (c0, c1) => c0.GetEntityId().CompareTo(c1.GetEntityId()));
|
||||
#else
|
||||
var canvases = prefabStage != null
|
||||
? prefabStage.prefabContentsRoot.GetComponentsInParent<Canvas>()
|
||||
: Object.FindObjectsByType<Canvas>(FindObjectsInactive.Include, FindObjectsSortMode.InstanceID);
|
||||
#endif
|
||||
|
||||
var list = new List<Canvas>(canvases.Length);
|
||||
var menu = new GenericMenu();
|
||||
|
|
@ -56,13 +65,22 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
continue;
|
||||
|
||||
list.Add(root);
|
||||
|
||||
#if UNITY_6000_4_OR_NEWER
|
||||
menu.AddItem(new GUIContent($"{i}: {root.name}"), false, () => Focus(root.GetEntityId()));
|
||||
#else
|
||||
menu.AddItem(new GUIContent($"{i}: {root.name}"), false, () => Focus(root.GetInstanceID()));
|
||||
#endif
|
||||
}
|
||||
|
||||
menu.DropDown(rect);
|
||||
}
|
||||
|
||||
#if UNITY_6000_4_OR_NEWER
|
||||
private static void Focus(EntityId instanceId)
|
||||
#else
|
||||
private static void Focus(int instanceId)
|
||||
#endif
|
||||
{
|
||||
var obj = EditorUtility.EntityIdToObject(instanceId);
|
||||
var canvas = obj as Canvas;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "com.module.navigationtool",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.3",
|
||||
"displayName": "Module.NavigationTool",
|
||||
"description": "Support for navigation tools, like favorites, history and toolbars",
|
||||
"unity": "2019.2",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue