2025-06-07 17:43:34 +08:00

23 lines
531 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 用于不做渲染的UI对象仅保留射线检测
/// </summary>
[RequireComponent(typeof(CanvasRenderer))]
public class NonDraw : Graphic
{
protected override void Awake()
{
base.color = Color.clear;
}
protected override void OnPopulateMesh(VertexHelper vh)
{
vh.Clear();
}
// 重写方法以避免不必要的重绘调用
public override void SetMaterialDirty() { }
public override void SetVerticesDirty() { }
}