using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
class UGUIOpenedPanelEditor
{
static readonly Texture2D TexturePanel;
static UGUIOpenedPanelEditor()
{
TexturePanel =
AssetDatabase.LoadAssetAtPath("Assets/Editor/UIEditorHelp/open.png", typeof(Texture2D)) as Texture2D;
EditorApplication.hierarchyWindowItemOnGUI += CurrentOpenUIPanel;
}
static void CurrentOpenUIPanel(int instanceID, Rect selectionRect)
{
Rect r = new Rect(selectionRect);
r.x = 0;
r.width = 20;
GameObject go = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
if (go != null)
{
//满足条件绘制Icon
var canvasGroup = go.GetComponent<CanvasGroup>();
if (canvasGroup != null && canvasGroup.alpha >= 1)
{
GUI.Label(r, TexturePanel);
}
}
}
}