Before we start creating our game, it is a good idea to figure out our controls. We'll create a script that will hold our inputs, and create control profiles for both the keyboard/mouse as well as the Xbox 360 Controller. Then, we'll add functionalities to be able to switch between the profiles and customize them as well. Control configurations like these are a key element to games, especially PC games.
In this chapter, we will cover the following topics:
Creating controls for the Xbox 360 Controller
Creating controls for a keyboard
Writing a function to detect whether our controller device is plugged in
Customizing our controls
Letting players switch controls
Switching controls with Graphical User Interface (GUI) buttons
Resetting controls back to factory settings