鼠标屏幕坐标命中世界物体
可用 射线,和摄像机 来判断
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Physics.Raycast(ray, out hit); string tag = hit.collider.gameObject.tag; Debug.Log("click is " + tag); if (tag == "enemy") { _target = hit.collider.gameObject; this.applyTarget(); }