📜  单击对象时的统一检查 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:24.309000             🧑  作者: Mango

代码示例1
void Update()
{
  // Check for mouse input
  if (Input.GetMouseButton(0))
  {
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
       RaycastHit hit;
       // Casts the ray and get the first game object hit
       Physics.Raycast(ray, out hit);
       Debug.Log("This hit at " + hit.point );
  }
}