标签:unit manage npoi transform == 摄像机 sep out physics
if (Input.GetMouseButtonDown(0))
{
Ray ray = MainCamera.ScreenPointToRay(Input.mousePosition); //以摄像机为原点创建一条射线
RaycastHit hit;
if (Physics.Raycast(ray, out hit)) //点击到了带有碰撞体的物体
{
Transform clickObjTrans = hit.transform; //获取点击的物体
if (clickObjTrans.name == "Manager")
{
}
}
}
标签:unit manage npoi transform == 摄像机 sep out physics
原文地址:http://www.cnblogs.com/Study088/p/7363935.html