void Update () {
Vector3 paddlePos = new Vector3(0.5f, this.transform.position.y, 0f);
float mousePosInBlocks = Input.mousePosition.x / Screen.width * 16;
paddlePos.x = Mathf.Clamp(mousePosInBlocks, 0.5f, 15.5f);
this.transform.position = paddlePos;
}
Hello Manthan, welcome to the community
Could you post a screenshot also please, with the Paddle selected within the Hierarchy, so that it’s details are available in the Inspector.
See also;
- Forum User Guides : How to apply code formatting within your post