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 - Unity Tutorial
From the course: Advanced Unity 2D: Platformer Player Movement
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Input introduction5m 52s
-
(Locked)
Building an input manager5m 55s
-
(Locked)
Abstracting axis input5m 2s
-
(Locked)
Building an input state class4m 31s
-
(Locked)
Tracking button release states4m 7s
-
(Locked)
Reading from the input state class4m 39s
-
(Locked)
Building multiple input managers for multi-player games2m 52s
-
-
-
-
-
-
-
-
-
-
-
-