# Input Processing
Engine processes user input using pre-configured listeners. Each input listener has the following properties:
|Name||Identifier of the input listener. Used to reference the listener by other engine systems.|
|Always Process||Whether to process the input while in input blocking mode. E.g. when playing a movie.|
|Keys||List of keys (buttons) which activate the input.|
|Axes||List of axes (eg, a mouse or a gamepad analog stick) which activate the input.|
|Swipes||List of swipes (touch screen) which activate the input.|
For specific values see Unity's input guide: docs.unity3d.com/Manual/ConventionalGameInput.
You can configure the built-in input bindings and add new listeners using
Naninovel -> Configuration -> Input context menu; for available options see configuration guide.
Example of adding a custom input binding to toggle inventory UI can be found in the inventory example project on GitHub.
Specifically, the custom "ToggleInventory" binding is used in UI/InventoryUI.cs runtime script. A binding with the same name is added via input configuration menu, under Control Scheme.
It's possible to halt and resume input processing with
# Gamepad and Keyboard
All the built-in features are usable with gamepad or keyboard input. You can remove, change or add gamepad/keyboard-specific hotkey bindings via the aforementioned bindings editor menu.
The built-in UIs can also be navigated with a gamepad or keyboard, without using mouse or touch input. When in any of modal menus (outside of main gameplay mode, eg title menu, backlog, etc), press a navigation key (directional pad or left stick on gamepad, arrow keys on keyboard) to select a button in the menu. The first focused button (game object) can be changed in each UI using
Focus Object field.
Focus Mode property you can change whether the assigned game object should be focused immediately after the UI becomes visible or after a navigation key is pressed.
Gamepad navigation over UIs will only work when Unity's new input system is installed in the project; find more information about the input system below.
When in the main gameplay mode (outside of modal UIs), press a button bind to
Pause input (
Backspace key for keyboard and
Start button for gamepad by default) to open pause menu, where you can save/load game, open settings, exit to title, etc.
# Input System
Naninovel supports Unity's new Input System; see the official docs on how to install and enable the input system package.
Touch and object-related input is still processed via legacy input, so don't completely disable legacy backend in the player settings, unless you're going to implement the features yourself.
After the package is installed, create an event system prefab; you can use
UI -> Event System in the hierarchy window to create a default one. Make sure
Input System UI Input Module is attached to the prefab. When creating a default event system, Unity will suggest to automatically convert legacy input module component to the new one.
Assign the created event system prefab to
Custom Event System property in the Naninovel UI configuration menu, then disable
Spawn Input Module in the same menu.
When the input system package is installed, an
Input Actions property will appear in the input configuration menu. Assign input actions asset to the property, then create "Naninovel" action map and add input actions with names equal to the Naninovel's binding names. The list of the built-in binding names can be found in the "Bindings" list under "Control Scheme" in the same configuration window. Below is an example input actions configuration.
Default input actions asset is stored at
Naninovel/Prefabs/DefaultControls.inputactions. Feel free to use it as a reference when creating your own.
When properly configured, input actions will activate Naninovel's bindings. In case you wish to disable legacy input processing (which is set under the "Bindings" list), disable
Process Legacy Bindings property under input configuration menu.
Find an example project on using the new input system and implementing a rebind UI to allow player change default controls on GitHub: github.com/Naninovel/Input.
For more information on using the input system, consult the official manual.