Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 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.  
  19. EditorGUI.DrawRect(selectionRect, gameObject.GetComponent<EditorItem>() .color);
  20. }
  21. if (gameObject.name.StartsWith("---", System.StringComparison.Ordinal))
  22. {
  23. EditorGUI.DrawRect(selectionRect, Color.gray);
  24. }
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement