Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEditor;
  3. [InitializeOnLoad]
  4. public static class HierarchyHeader
  5. {
  6.     static HierarchyHeader()
  7.     {
  8.         EditorApplication.hierarchyWindowItemOnGUI += HierarchyItem;
  9.     }
  10.  
  11.     static void HierarchyItem(int instanceID, Rect selectionRect)
  12.     {
  13.         var gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
  14.         if (gameObject != null)
  15.         {
  16.             if (gameObject.GetComponent("EditorItem"))
  17.             {
  18.                 EditorGUI.DrawRect(selectionRect, gameObject.GetComponent<EditorItem>() .color);
  19.             }
  20.             if (gameObject.name.StartsWith("---", System.StringComparison.Ordinal))
  21.             {
  22.                 EditorGUI.DrawRect(selectionRect, Color.gray);
  23.             }
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement