Here’s a quick overview on Unity’s Input System Actions and Action Maps.
The names that show under Actions, are in fact, the names of the events that should be coded: OnNavigate
, OnSubmit
, OnCancel
, etc.
The Pass Through action type tells unity not to try and resolve conflicting inputs for the same action and to allow any control that is mapped to the action take control of it. Read more on the Input System Action Types documentation (1.6.3). Make sure to check the version you are using.
In order to use the actions in the UI action map, it has to be selected as the default action map through the inspector:
This works well for main menu scenes.
It is also possible to switch maps programmatically, from Switching action maps:
void EnablePlayerAndUiMaps()
{
// Enable each map individually
playerInput.actions.FindActionMap("Player").Enable();
playerInput.actions.FindActionMap("UI").Enable();
// to disable one, call .Disable():
// playerInput.actions.FindActionMap("UI").Disable();
}
The action map name comes from the name of your map in the input actions dialog: