Unity – Get mouse position

Vector3 inputPosition = Input.mousePosition; 
Vector3 ray = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width - inputPosition.x, Screen.height - inputPosition.y, Camera.main.transform.position.z - 2f));
Advertisements