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 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()); | |
} | |
} | |
} |
thanks for your work! forked to compile only in editor, in a namespace and simplified to 1 kind of header only
https://gist.github.com/ParkingLotGames/c17581afd0f754fd19f79bc82ca99bbc
Brilliant add-on to any project. Perfect 5/7.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!
Upgraded with colors : https://gist.github.com/farukcan/fbed41147735c799466d95550c3216db