unity 鼠标点击位置判断

判断鼠标位置是否在某RectTransform区域内

if(RectTransformUtility.RectangleContainsScreenPoint(transform.GetComponent<RectTransform>(), 
    Input.mousePosition, Cameras.UI))
{
    
        
     Debug.Log("在遮挡范围内");
}

猜你喜欢

转载自blog.csdn.net/weixin_45023328/article/details/128588289