using UnityEngine;
using UnityEngine.UI;
public class ImagePlus : Image
{
PolygonCollider2D m_Collider;
protected override void Awake()
{
base.Awake();
m_Collider = GetComponent<PolygonCollider2D>();
}
override public bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera)
{
return ContainsPoint(m_Collider.points, screenPoint);
}
bool ContainsPoint(Vector2[] polyPoints, Vector2 p)
{
var inside = false;
if (m_Collider.OverlapPoint(p))
{
inside = !inside;
}
return inside;
}
}
UGUI 不规则按钮的响应区域
最新推荐文章于 2023-04-22 23:23:00 发布