From the course: Advanced Unity 2D: Platformer Player Movement

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Building an input manager

Building an input manager - Unity Tutorial

From the course: Advanced Unity 2D: Platformer Player Movement

Start my 1-month free trial

Building an input manager

- So while working directly with the axes inside of Unity is helpful and really good for quick demos, what we really need to do is come up with a better way of abstracting the relationship between our game objects and the input that they receive. One of the ways that we're gonna be able to do this is by actually mapping all input that's received in the game to a special set of enums. These enums are going to be simple button references such as up, down, left, right, A, B, select, start, all the things that you'd normally associate with game input. Then, on the other end, we'll write a class that will accept all the input that comes in from Unity and map them to these buttons. To get started, we're gonna create an input manager. Inside of our script folder, let's created a new C# class called InputManager. And this will be our own custom input manager. Next, we're gonna need to create an enum class. We're gonna do this above the input manager so that it's accessible throughout the…

Contents