Unity自定义事件相应区域

public class MyImage : Image

{

   //判断点击的坐标是否可以引发事件

   //public override bool IsRaycastLocationValid(Vector2 screenPoint,Camera eventCamera)

   //{

   //    return GetComponent<PolygonCollider2D>().OverlapPoint(screenPoint);

   //}

   public override bool Raycast(Vector2 sp, Camera eventCamera)

    {

       return GetComponent<PolygonCollider2D>().OverlapPoint(sp);

    }

}

猜你喜欢

转载自blog.csdn.net/qq_25601345/article/details/77777012