23 lines
621 B
C#
23 lines
621 B
C#
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
/// <summary>
|
||
/// 用于不做渲染的UI对象,仅保留射线检测
|
||
/// </summary>
|
||
[RequireComponent(typeof(CanvasRenderer))]
|
||
public class NonDrawingGraphic : Graphic
|
||
{
|
||
protected override void Awake()
|
||
{
|
||
color = new Color(0, 0, 0, 0);
|
||
}
|
||
protected override void OnPopulateMesh(VertexHelper vh)
|
||
{
|
||
vh.Clear();
|
||
}
|
||
|
||
// 如果不需要渲染,可以直接覆盖 SetMaterialDirty 和 SetVerticesDirty 方法来防止不必要的重绘调用
|
||
public override void SetMaterialDirty() { }
|
||
public override void SetVerticesDirty() { }
|
||
}
|