Move the Paddle

We are ready to rock. If we just set the x position of Paddle to the mouse's screen position by using Input.mousePosition, we should be able to use the mouse to move the paddle. Change your line of code so that it looks like this:

transform.position.x = Input.mousePosition.x;

Save your Script and try it out.

Get Unity 4.x Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.