From 2a354e7da55da87b0cc80286980b30c3874f76b3 Mon Sep 17 00:00:00 2001 From: Anders Ejlersen Date: Thu, 18 Jul 2024 19:27:13 +0200 Subject: [PATCH] Fixed layout issues in Unity 6, where height was not set to 22px on parent VisualElement --- CHANGELOG.md | 6 ++++++ Editor/Toolbar/Tools/ToolUICanvasPicker.cs | 15 ++++++++++++++- Editor/Toolbar/Utilities/ToolbarUtility.cs | 10 ++++++++-- package.json | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efb01f4..7257d56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## [1.9.5] - 2024-07-18 + +### Fixed +- Fixed layout issues in Unity 6, where height was not set to 22px on parent VisualElement + + ## [1.9.4] - 2024-04-18 ### Added diff --git a/Editor/Toolbar/Tools/ToolUICanvasPicker.cs b/Editor/Toolbar/Tools/ToolUICanvasPicker.cs index 7d487c3..c5126c3 100644 --- a/Editor/Toolbar/Tools/ToolUICanvasPicker.cs +++ b/Editor/Toolbar/Tools/ToolUICanvasPicker.cs @@ -31,7 +31,20 @@ namespace Module.NavigationTool.Editor.Toolbar return; PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage(); - Canvas[] canvases = prefabStage != null ? prefabStage.prefabContentsRoot.GetComponentsInParent() : Object.FindObjectsOfType(); + Canvas[] canvases; + + if (prefabStage != null) + { + canvases = prefabStage.prefabContentsRoot.GetComponentsInParent(); + } + else + { + #if UNITY_6000_0_OR_NEWER + canvases = Object.FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.InstanceID); + #else + canvases = Object.FindObjectsOfType(); + #endif + } var list = new List(canvases.Length); var listNames = new List(canvases.Length); diff --git a/Editor/Toolbar/Utilities/ToolbarUtility.cs b/Editor/Toolbar/Utilities/ToolbarUtility.cs index bdc08ba..e0d4a46 100644 --- a/Editor/Toolbar/Utilities/ToolbarUtility.cs +++ b/Editor/Toolbar/Utilities/ToolbarUtility.cs @@ -72,7 +72,10 @@ namespace Module.NavigationTool.Editor.Toolbar { style = { flexGrow = 1, - flexDirection = FlexDirection.Row + flexDirection = FlexDirection.Row, + #if UNITY_6000_0_OR_NEWER + height = 22f + #endif } }; @@ -89,7 +92,10 @@ namespace Module.NavigationTool.Editor.Toolbar { style = { flexGrow = 1, - flexDirection = FlexDirection.RowReverse + flexDirection = FlexDirection.RowReverse, + #if UNITY_6000_0_OR_NEWER + height = 22f + #endif } }; diff --git a/package.json b/package.json index 93cafb5..085c27a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.module.navigationtool", - "version": "1.9.4", + "version": "1.9.5", "displayName": "Module.NavigationTool", "description": "Support for navigation tools, like favorites, history and toolbars", "unity": "2019.2",