O'Reilly logo

Unity 3D Game Development by Example by Ryan Henson Creighton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Move the Paddle

We are ready to rock. If we just set the paddle's x position 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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required