Fixed layout issues in Unity 6, where height was not set to 22px on parent VisualElement

This commit is contained in:
Anders Ejlersen 2024-07-18 19:27:13 +02:00
parent 70e110496e
commit 2a354e7da5
4 changed files with 29 additions and 4 deletions

View file

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

View file

@ -31,7 +31,20 @@ namespace Module.NavigationTool.Editor.Toolbar
return;
PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
Canvas[] canvases = prefabStage != null ? prefabStage.prefabContentsRoot.GetComponentsInParent<Canvas>() : Object.FindObjectsOfType<Canvas>();
Canvas[] canvases;
if (prefabStage != null)
{
canvases = prefabStage.prefabContentsRoot.GetComponentsInParent<Canvas>();
}
else
{
#if UNITY_6000_0_OR_NEWER
canvases = Object.FindObjectsByType<Canvas>(FindObjectsInactive.Include, FindObjectsSortMode.InstanceID);
#else
canvases = Object.FindObjectsOfType<Canvas>();
#endif
}
var list = new List<Canvas>(canvases.Length);
var listNames = new List<string>(canvases.Length);

View file

@ -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
}
};

View file

@ -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",