Unity自定义事件相应区域

来源:互联网 发布:mac版desmume金手指 编辑:程序博客网 时间:2024/06/07 17:21

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);

    }

}

原创粉丝点击