public static void OnHierarchyWindowItemDraw(int id, Rect rect)
{
var o = EditorUtility.InstanceIDToObject(id);
if (o is GameObject)
{
var go = o as GameObject;
if (Event.current.type == EventType.MouseDown
&& Event.current.button == 0
&& rect.Contains(Event.current.mousePosition))
{
var temp = go.transform;
while (temp != null)
{
var c = temp.GetComponent<TestComponent>();
if (c != null) break;
temp = temp.parent;
}
if (temp != null) SelectInHierarchy(temp.gameObject);
}
}
}