Unity C# Move an Object with a Key press

Subscribers:
33,700
Published on ● Video Link: https://www.youtube.com/watch?v=CvmJL6dn-hM



Duration: 4:50
14,469 views
0


How to move a player with key strokes.

First, drag the image into the Asset section and then into the scene.

Second, add a Rigidbody2d, this allows for the application of physics to the object, and set gravity to 0.

Third, add a script which defines the key strokes you wish to check for.

Fourth, add the IF statements to declare what should happen when those keys are pressed.

Lastly, add the velocity statements.







Tags:
C# (Programming Language)
Unity (Software)