Created
July 7, 2021 02:10
-
-
Save baba-s/375f4fa8eda7b0480513983ed2599dd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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