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