Input axes

The input module features several named axes. An input axis is a named, linear space that maps to an input device and typically generates normalized values when input events are received. For example, the horizontal axis, by default, maps to the left and right keys on the keyboard. Left corresponds to -1, right corresponds to 1, and pressing nothing corresponds to the neutral 0. This convention is especially convenient for creating movement scripts with vectors. Other input axes are officially buttons, which have an on and off (boolean) status instead. The named input axes can be accessed, edited, and configured from within the Unity editor, by choosing Edit | Project Settings | Input from the application menu:

Accessing input ...

Get Mastering Unity 2017 Game Development with C# - Second Edition 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.