如果使用image alpha = 0,会导致overDraw,直接清空mesh,不绘制即可避免
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
using UnityEngine.UI;
namespace UnityGameFramework
{
[AddComponentMenu("Game/UI/GameEmpty4Raycast")]
[RequireComponent(typeof(CanvasRenderer))]
public class GameEmpty4Raycast : MaskableGraphic
{
protected GameEmpty4Raycast()
{
useLegacyMeshGeneration = false;
}
protected override void OnPopulateMesh(VertexHelper toFill)
{
toFill.Clear();
}
}
#if UNITY_EDITOR
[CustomEditor(typeof(GameEmpty4Raycast))]
public class GameEmpty4RaycastEditor : Editor
{
private bool _showDetail;
private void OnEnable()
{
_showDetail = false;
}
public override void OnInspectorGUI()
{
if (_showDetail)
{
base.OnInspectorGUI();
}
using (new GUIColorScope(_showDetail ? Color.red : Color.green))
{
if (GUILayout.Button(_showDetail ? "隐藏详细信息":"显示详细信息"))
{
_showDetail = !_showDetail;
}
}
}
}
#endif
}