User input

The first and relatively simple functionality we can add is the ability to jump. We already have basic physics with gravity working on the Player game object. Before we can make our Player game object jump, we need to know when this should happen. The user always needs some sort of interface in order to interact with the game. On the PC and Mac, in most of cases, it will be the mouse or keyboard. On mobile devices, it will be the touchscreen.

Unity gives us a lot of out-of-the-box functions we can call to check whether user is trying to interact through any input.

As we are writing a standalone game, I think it best if we stick to the mouse control.

Please open the Unity Scripting Reference and search for Input. You can have a read through ...

Get Unity 5: Learning C# by Developing Games now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.