unity c# get mouse click code example
Example 1: unity mouse click position
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(ray, out hit))
{
return hit.point;
}
Example 2: unity c# get mouse click
// Detect left mouse button click
if(Input.GetMouseButtonDown(0)){
// do something
}