move player to mouse position unity code example
Example 1: unity get mouse position
Vector3 worldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Example 2: unity mouse click position
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(ray, out hit))
{
return hit.point;
}