Skip to content

Commit 151fda5

Browse files
committed
Optimized tree lines rendering
1 parent 58cc9ee commit 151fda5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Assets/Editor Toolbox/Editor/Hierarchy/HierarchyPropertyLabel.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,19 +407,19 @@ public void OnGUI(Rect rect, GameObject target, int siblingIndex, bool isCurrent
407407
if (GetParentChildCount(target) == (siblingIndex + 1))
408408
{
409409
renderedLastLevelGameobject = true;
410-
EditorGUI.LabelField(rect, "└", Style.centreAlignTreeLineStyle);
410+
EditorGUI.LabelField(rect, Style.elementLast, Style.centreAlignTreeLineStyle);
411411
}
412412
else
413413
{
414414
renderedLastLevelGameobject = false;
415-
EditorGUI.LabelField(rect, "├", Style.centreAlignTreeLineStyle);
415+
EditorGUI.LabelField(rect, Style.elementCross, Style.centreAlignTreeLineStyle);
416416
}
417417
}
418418
else
419419
{
420420
if (!renderedLastLevelGameobject)
421421
{
422-
EditorGUI.LabelField(rect, "│", Style.centreAlignTreeLineStyle);
422+
EditorGUI.LabelField(rect, Style.elementPass, Style.centreAlignTreeLineStyle);
423423
}
424424
}
425425
}
@@ -463,8 +463,16 @@ protected static class Style
463463
internal static readonly GUIStyle rightAlignTextStyle;
464464
internal static readonly GUIStyle centreAlignTreeLineStyle;
465465

466+
internal static readonly GUIContent elementLast;
467+
internal static readonly GUIContent elementCross;
468+
internal static readonly GUIContent elementPass;
469+
466470
static Style()
467471
{
472+
elementLast = new GUIContent("└");
473+
elementCross = new GUIContent("├");
474+
elementPass = new GUIContent("│");
475+
468476
defaultAlignTextStyle = new GUIStyle(EditorStyles.miniLabel)
469477
{
470478
#if UNITY_2019_3_OR_NEWER

0 commit comments

Comments
 (0)