Unity Controller Inputs

Posted by Mark Marcikic, on February 13, 2017

In our first post I wanted to write a bit about inputs in Unity, more specifically about using an Xbox controller in our game. Everything starts in the input manager that you can open by clicking:
Edit -> Project Settings -> Input


Here we can freely modify the already existing inputs or add new ones by increasing the size of the axes (when you do this, a copy of the last one is created).
If we open up an input, we can see that two positive buttons can be added to it; in our case, one will be the keyboard, the alt will be the controller.


Here I assigned the space key and joystick button 0 (which, if you take a look at the first picture, is the A button on the Xbox controler) to the "Jump" input, so now both of these can be used to make our character jump.

Now that our character can jump, we could also make it go left and right. For this we'll use the the "Horizontal" input.


This will be simple enough, because "Horizontal" is alread defined, so we just have to make use of it.

Note that both the "Horizontal" and "Vertical" inputs have negative buttons as well, which will operate with the negative of the given value.


Copyright © Brute Drop 2017