- Unity 4.x Game Development by Example Beginner's Guide
- Ryan Henson Creighton
- 58字
- 2025-03-31 04:02:12
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.