Last active
March 22, 2023 17:27
-
-
Save giacomelli/35410d682e41a504c7869a464a96c30a to your computer and use it in GitHub Desktop.
#unitytips: Hierarchy Window Group Header - http://diegogiacomelli.com.br/unitytips-hierarchy-window-group-header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
/// <summary> | |
/// Hierarchy Window Group Header | |
/// http://diegogiacomelli.com.br/unitytips-hierarchy-window-group-header | |
/// </summary> | |
[InitializeOnLoad] | |
public static class HierarchyWindowGroupHeader | |
{ | |
static HierarchyWindowGroupHeader() | |
{ | |
EditorApplication.hierarchyWindowItemOnGUI += HierarchyWindowItemOnGUI; | |
} | |
static void HierarchyWindowItemOnGUI(int instanceID, Rect selectionRect) | |
{ | |
var gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject; | |
if (gameObject != null && gameObject.name.StartsWith("---", System.StringComparison.Ordinal)) | |
{ | |
EditorGUI.DrawRect(selectionRect, Color.gray); | |
EditorGUI.DropShadowLabel(selectionRect, gameObject.name.Replace("-", "").ToUpperInvariant()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brilliant add-on to any project. Perfect 5/7.