Actually,
Input.GetMouseButtonDown returns true during the frame the user pressed the given mouse button.
If you want to get mouse position on click then you can use Input.mousePosition in Input.GetMouseButtonDown is true, it will return mouse position in pixel coordinates.
Update() { if (Input.GetMouseButtonDown(0)) Debug.Log("Mouse position: " + Input.mousePosition); }
Edit: It also works like a charm on touch devices. For single touch on touch devices you can use it without any doubt.
Edit2: As I mentioned that Input.mousePosition will give you pixel coordinates not world coordinates. Basically you are comparing Pixel point and World point, that'd obviously not gonna do what you want. But you can simply convert screen point to world point through ScreenToWorldPoint. Like,
Vector3 mouseWorldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); distance = Vector3.Distance (mouseWorldPosition , button.position); ...