You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/3rd/D2D_Scripts/Tools/Editor/HierarchyWindowGameObjectIc...

26 lines
864 B
C#

using UnityEditor;
using UnityEngine;
/// <summary>
/// Hierarchy window game object icon.
/// http://diegogiacomelli.com.br/unitytips-hierarchy-window-gameobject-icon/
/// </summary>
[InitializeOnLoad]
public static class HierarchyWindowGameObjectIcon
{
const string IgnoreIcons = "GameObject Icon, Prefab Icon";
static HierarchyWindowGameObjectIcon()
{
EditorApplication.hierarchyWindowItemOnGUI += HandleHierarchyWindowItemOnGUI;
}
static void HandleHierarchyWindowItemOnGUI(int instanceID, Rect selectionRect)
{
var content = EditorGUIUtility.ObjectContent(EditorUtility.InstanceIDToObject(instanceID), null);
if (content.image != null && IgnoreIcons.Contains(content.image.name))
GUI.DrawTexture(new Rect(selectionRect.xMax - 16, selectionRect.yMin, 16, 16), content.image);
}
}