Skip to content

Commit 0f19a96

Browse files
committed
v1.0.10
Fix Hierarchy overlay width calculation outside OnGUI: - remove EditorGUIUtility.currentViewWidth fallback from update path - use hierarchy window width, then UIElements resolved width, then safe constant fallback to prevent ArgumentException
1 parent cb29238 commit 0f19a96

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

Editor/HierarchyFolder/HierarchyFolderNavbar.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,20 @@ private static float GetHierarchyWindowWidth()
123123
{
124124
if (_hierarchyWindow != null && _hierarchyWindow?.position.width > 0f)
125125
return (float)_hierarchyWindow.position.width;
126-
return EditorGUIUtility.currentViewWidth;
126+
127+
if (_overlay != null)
128+
{
129+
var parent = _overlay.parent;
130+
if (parent != null)
131+
{
132+
float resolvedWidth = parent.resolvedStyle.width;
133+
if (resolvedWidth > 0f && !float.IsNaN(resolvedWidth) && !float.IsInfinity(resolvedWidth))
134+
return resolvedWidth;
135+
}
136+
}
137+
138+
// Safe non-OnGUI fallback (avoid EditorGUIUtility.currentViewWidth here).
139+
return 300f;
127140
}
128141

129142
private static float GetOverlayLeft(float hierarchyWidth)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.nomorepain.editor",
3-
"version": "1.0.9",
3+
"version": "1.0.10",
44
"displayName": "No More Pain Editor",
55
"description": "Unity Editor productivity tools: Inspector Tabs, Play Mode Save, Component Copy/Paste and more.",
66
"unity": "2021.3",

0 commit comments

Comments
 (0)