One of the main issues when designing the player movements or UI navigation is assigning the appropriate input for the controls. In this regard, Unity is perfect for the job. Since 2019 the software, offers the developer the option to download a free package named “Input System”.
Using this system, you can configure different “Action Maps”. For example, if your player is moving on foot using a specific set of controls and suddenly decides to pick up a car, these action maps allow the developer the power to easily change the player controls from being on foot to the ones when he is driving, completely changing the actions that happen when pushing the same buttons. This way the developer can configure a specific set of controls for each state the player may be in.
But that is just the tip of the iceberg as each action allows to easily set up the controls for each specific action. Take an example of the picture above. We have 2 different action maps: one where the players are in the game (InGame) fighting to get the pollen and another one where they are interacting with the menu (InMenu), be it the pause menu or the main menu screen.
For the InGame map we can create as many actions as we need (move, sting, throw shurikens…) and each one of them assign them to a specific key or button. Now we just need to bind these actions to actual controls, like keys, buttons, triggers…
Unity excels at this point and allows the developer to bind a control by searching on a list of all the possible controls (including all the gamepads of all the official companies) or just by clicking on the listed button. By clicking the listed button, it will automatically register ALL the inputs it receives from keyboard and connected gamepads, searching on its database the received input information, making the whole process of selecting the appropriate binding much quicker and easier.
Besides that, each action can be assigned with a special interaction, this basically restricts the action to only activate or work when certain conditions are met, for example: tap X times, hold X amount of time…