Many gamers, myself included, use a variety of controls to play PC games. The two control devices I decided to support right from the beginning are the keyboard and mouse as well as the Xbox controller, which Steam data reports as the most popular gaming controller by a large margin.
Thankfully Unity makes it easy to support multiple control setups simultaneously, but I wanted the user interface of Sneak 'Em Up (working title) to also adapt in real time to the user. To do so I created a script which detected input from either the keyboard or an Xbox controller. This script then sets a global variable which other objects in the game reference. This global variable acts as a signal telling the rest of the game whether the last input made by the player was made on a keyboard or an Xbox controller.
Button prompts show up several places in Sneak 'Em Up's levels. Most obviously, they appear on the HUD UI, reminding the player which button is responsible for using equipped weapons and items.
Prompts also appear above the character's head when they are close to an interactable object such as a body or a switch. And finally, button prompts can exist in the game level itself as a "sign" during the tutorial. In the future, button prompts may also be seen in dialogs, when characters help explain how to play in the early tutorial levels.
Putting this all together, the control manager script described above sends information on the player's last input to all these systems, giving the player real time contextual prompts that make playing intuitive.
Leave a Reply.