鼠标是否在UI(Image)上,(重点)且可能会被其它UI阻挡
我用过两种方法都能检测在UI上,但是不会被阻挡,请问该怎么实现遮盖的效果呢?
以下是用过的方法,还有一个是OnMouseEnter();
Vector2 mouP = Camera.main.ScreenToWorldPoint(Input.mousePosition);
bool isUI = RectTransformUtility.RectangleContainsScreenPoint(transform.GetComponent<RectTransform>(), mouP);
同学你好,可以参考一下:
https://blog.csdn.net/Memoryuuu/article/details/80937541
https://blog.csdn.net/loushuai/article/details/78993984
https://blog.csdn.net/weixin_41814169/article/details/85604713
https://www.cnblogs.com/linzheng/p/3973971.html
https://www.sohu.com/a/211244406_667928