Skip to content

Instantly share code, notes, and snippets.

@giacomelli
Last active March 22, 2023 17:27
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save giacomelli/35410d682e41a504c7869a464a96c30a to your computer and use it in GitHub Desktop.
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
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());
}
}
}
@farukcan
Copy link

@ParkingLotGames
Copy link

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

@clutchm0nkey
Copy link

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