标签:检测 turn sep public mouseover NPU return bsp int
public class someclass:monobehaviour
{
public EventSystem eventssystem;
public GraphicRaycaster gra;
/// <summary>
/// 射线检测
/// </summary>
/// <param name="Name"></param>
/// <returns></returns>
public bool MouseOver(string Name)
{
var mPointerEventData = new PointerEventData(eventssystem);
mPointerEventData.position = Input.mousePosition;
List<RaycastResult> results = new List<RaycastResult>();
gra.Raycast(mPointerEventData, results);
return results.Any(data => data.gameObject.name == Name);
}
}
标签:检测 turn sep public mouseover NPU return bsp int
原文地址:https://www.cnblogs.com/baozhu/p/12070432.html