方便寻找场景里开启了raycast的组件
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEngine.UI;
namespace Engine
{
public class GizomsUILine : MonoBehaviour
{
static Vector3[] fourCorners = new Vector3[4];
void OnDrawGizmos()
{
foreach (MaskableGraphic g in FindObjectsOfType<MaskableGraphic>())
{
if (g.gameObject.activeInHierarchy && g.raycastTarget)
{
RectTransform rectTransform = g.transform as RectTransform;
rectTransform.GetWorldCorners(fourCorners);
Gizmos.color = Color.blue;
for (int i = 0; i < 4; i++)
{
Gizmos.DrawLine(fourCorners[i], fourCorners[(i + 1) % 4]);
}
}
}
}
}
}
#endif