Input Module Addition
There are individual Input Module Additions for all supported Input Systems.
They all function basically the same: There are multiple entries where you can specify the Input Mapping that should be bound.
Please read about Input Action Bindings to get a better understanding of how this is used.
You can add it by right-clicking on your input module and select "Add Additional Button Mapping".
Bindings for Navigation Visualization
The "Addition For Standalone Input Module" (Legacy Input System) and the "Addition For Rewired Standalone Input Module" (Rewired) have this section.
This is only for one case: Visualizing that the user can navigate in any direction to trigger something.
Because the legacy and rewired input modules use two bindings (horizontal and vertical) for navigation, an Input Action Visualization could not map to a "Any Direction" mapping. So, you can select if it shall map to Horizontal or Vertical instead.
If you then check the checkbox below, every navigation-direction will map to the one specified for visualization.
Note: This is for visualization only. It does not affect the bindings. Also, it is for the standard navigation, not for Context Left / Right / Up / Down.
Legacy Input System
The Legacy Input module requires Joystick axis mappings in order to detect if a joystick (or gamepad) was causing the input. If this is not specified correctly, you will see errors in the logs.
Specify them in the Input Manager Settings like this:
"New" Input System
Rewired
Supporting other Input Systems
If you are using a different Input System in your game, you can write your own implementation, if that Input System comes with an Input Module (otherwise you would also need to write that).
First of all, you need a custom Input Detector and register it to "BetterNavigation.InputDetectorsForInputModulesFactories" at the very beginning of your game.
If the Input Module is like the legacy input module or rewired and comes with two axis-fields for navigation, derive your class, do it similar to the "Addition For Standalone Input Module":
public class AdditionForStandaloneInputModule : InputModuleAdditionWithDualAxisNavigation<string, StandaloneInputModule>
{
protected override string HorizontalAxis => InputModule.horizontalAxis;
protected override string VerticalAxis => InputModule.verticalAxis;
protected override bool IsDown(string buttonName)
{
if (string.IsNullOrEmpty(buttonName))
return false;
return InputModule.input.GetButtonDown(buttonName);
}
}
You would need to:
- Rename the class
- Replace the generic parameter "StandaloneInputModule" with the input module type of your input system
- Replace all occurrences of "string" with the type that is used for action bindings in your input system
- Maybe Change or remove the null-or-empty-check to let it compile with your action binding type
- Replace "horizontalAxis" and "verticalAxis" with the fields used by your input module for navigation.
If the Input Module is like the "new" input system and has one field for moving, do it like the "Addition For Input System Ui Input Module":
public class AdditionForInputSystemUiInputModule : InputModuleAddition<InputActionReference, InputSystemUIInputModule>
{
protected override InputActionReference NavigateInAnyDirection => InputModule.move;
protected override InputActionReference NavigateUp => InputModule.move;
protected override InputActionReference NavigateDown => InputModule.move;
protected override InputActionReference NavigateLeft => InputModule.move;
protected override InputActionReference NavigateRight => InputModule.move;
protected override bool IsDown(InputActionReference button)
{
if(button == null)
return false;
return InputDetectorForNewInputSystem.IsActionPressed(button);
}
}
You would need to:
- Rename the class
- Replace the generic parameter "InputSystemUiInputModule" with the input module type of your input system
- Replace all occurrences of "InputActionReference" with the type that is used for action bindings in your input system
- Maybe change or remove the null-check to let it compile with your action binding type
- Replace "move" with the field that is used by your input module for navigation