when mouse click a gameobject ,how can I get the position of mouse click gameobject

when mouse click a gameobject ,how can I get the position of mouse click gameobject. I want drag a gameobject and move

The answer would depend on whether you wanted to get the position of the mouse click in screen coordinates or game world/space coordinates.

If it was the former, getting the position in screen coordinates usually means using something like:

Vector3 clickedPosition = Input.mousePosition;

If it was the latter, then you'd need to use something like the code below to get the position of the mouse click in game world/space coordinates:

Vector3 clickedPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);

To know more about other Input functions, head on over to the official Scripting reference page here: Link

Here's a complete solution for right click detection: http://blog.gfx47.com/2011/04/04/detect-right-click-on-game-objects-in-unity3d/ Hope that will help! ;)