Skip to content

Instantly share code, notes, and snippets.

@baba-s
Created Jul 7, 2021
Embed
What would you like to do?
using Kogane;
using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
internal static class Example
{
private const float SIZE = 20;
private const string NAME = "d_console.warnicon";
private static GUIContent m_icon;
static Example()
{
EditorApplication.hierarchyWindowItemOnGUI += OnGUI;
}
private static void OnGUI( int instanceID, Rect rect )
{
var gameObject = EditorUtility.InstanceIDToObject( instanceID ) as GameObject;
if ( gameObject == null ) return;
var hasMissingReference = MissingReferenceUtils.HasMissingReference( gameObject );
if ( !hasMissingReference ) return;
rect.x += rect.width - 2;
rect.y -= 2;
rect.width = SIZE;
rect.height = SIZE;
if ( m_icon == null )
{
m_icon = EditorGUIUtility.IconContent( NAME );
}
GUI.Label( rect, m_icon );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment