unity 2d get mouse position code example
Example 1: unity get mouse position
Vector3 worldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Example 2: unity how to convert mouse screen position to world position
Camera.main.ScreenToWorldPoint(Input.mousePosition)
Example 3: unity 2d how to set an object or the mouse position
Vector2 mousePos = new Vector2(camera.ScreenToWorldPoint(Input.mousePosition.x), camera.ScreenToWorldPoint(Input.mousePosition.y));