Skip to content

Input Processing

Naninovel uses Unity's Input System ↗ to listen for the following actions.

NameKeyboard+MouseGamepadDescription
SubmitEnterButton SouthGeneric confirm intent, such as accepting a prompt or submitting an input form.
CancelEscapeButton EastGeneric decline intent, such as declining a prompt or exiting a menu.
DeleteDeleteButton NorthGeneric delete intent, such as deleting selected save slot.
NavigateArrow KeysD-Pad, Left StickGeneric navigation intent, such as selecting save slots in a row.
ScrollScroll Wheel, Page Up/DownRight StickGeneric scroll intent, such as scrolling backlog.
PageLeft Trigger <-> Right TriggerGeneric paginate intent, such as changing pages in save-load menu.
TabLeft Bumper <-> Right BumperGeneric change tab intent, such as changing tabs in settings menu.
ContinueEnter, Scroll Wheel (Y+)Button SouthDisable wait for input mode (activated when a message is printed) to continue script playback.
PauseBackspaceStartShow Pause UI.
SkipCtrlButton WestEngage skip mode (fast-forward) while the action is activated (button held).
ToggleSkipTabRight Stick PressToggle (permanently enable if disabled and vice-versa) skip mode.
SkipMovieEscapeButton EastSkip (cancel) currently playing movie.
AutoPlayAButton EastToggle auto-play mode, where wait for input mode is disabled automatically after a set delay.
ToggleUISpaceButton NorthToggle visibility (hide/show) of the entire UI layer.
ShowBacklogLRight BumperToggle Backlog UI visibility.
RollbackB, Scroll Wheel (Y-)Left BumperRewind script backwards.
CameraLookMouse DeltaRight StickMove camera while in @look mode.
ToggleConsole`Toggle development console.

Customizing Inputs

You can configure the default actions and add new ones by assigning a custom Input Actions asset in the Naninovel -> Configuration -> Input context menu. Keep the associated actions under a Naninovel map to allow the engine to detect them. Default input action asset can be created with Create -> Naninovel -> Input -> Controls asset menu — feel free to use it as a reference when creating your own.

cover

EXAMPLE

An example of adding custom input binding to toggle inventory UI can be found in the inventory sample. Specifically, the custom "ToggleInventory" action is used in Scripts/Runtime/Inventory/UI/InventoryUI.cs runtime script. Another example — input rebind sample — implements a rebind UI to allow player to change default controls.

When using custom input actions, it's recommended to also use a custom Event System assigned in the same configuration menu, and then assign the custom input actions asset to the Actions Asset property of the Input System UI Input Module component attached to the event system prefab. This is required for various UI-related functionality to work correctly. You can create a default event system prefab that works with Naninovel via Create -> Naninovel -> Input -> Event System.

cover

TIP

To prevent actions with modifiers (such as Tab and Page) from triggering other actions that use the same bindings without modifiers (for example, Navigate), enable the Enable Input Consumption option in the project settings under the Input System Package category.

Adapt to Input Mode

By default, all the built-in UIs will adapt to the current input mode (mouse and keyboard, gamepad or touch) based on the last active input device. For example, if the player is using a mouse to interact with the game, but at some point presses a button on a gamepad, the UIs will switch to gamepad input mode.

cover

You can disable the feature by unchecking the Detect Input Mode option in the input configuration menu.

Default input mode activated after engine initialization is evaluated by the input manager based on the target platform:

  • Consoles -> Gamepad
  • Mobiles -> Touch
  • Others -> Mouse

Mouse

In this mode the UI will disable navigation on all the underlying Selectable ↗ objects. This is to prevent buttons from transitioning into "selected" state when clicked by mouse.

Additionally, in case Button Controls object is assigned in Custom UI (or derived) component, it will be enabled, while Keyboard Controls and Gamepad Conrols disabled. This allows keeping buttons specific to mouse input mode (eg, "close" button) and controls legend (eg, gamepad button labels) visible only when associated input mode is active.

Gamepad

Gamepad mode will keep navigation (change it back when switched from mouse mode), so that player is able to navigate selectables with dpad.

When assigned, Gamepad Controls legend will be enabled, while others (buttons and keyboard) — disabled.

TIP

If you'd like to customize gamepad legend icons, check out Xelu's free controller prompts ↗.

Additionally, while in gamepad mode and a modal UI is shown, first active selectable inside will be focused to prevent focus from getting stuck with previously selected object. This behaviour can be changed by explicitly assigning Focus Object of custom UI or derived component, in which case the UI won't attempt to find focus object automatically.

Keyboard

Activated when keyboard navigation (arrow) keys are pressed. Other keys won't activate this mode, because they are used in Mouse mode as hotkeys.

Otherwise, it works same as Gamepad mode, just with the different controls legend shown.

Touch

When in touch mode, Naninovel won't perform any special changes on the managed UIs by default. However, you can add touch-specific behaviour by overriding HandleInputModeChanged method of CustomUI component.

To disable the adapt to input mode feature for a specific UI, uncheck Adapt To Input Mode option of Custom UI (or derived) component. To disable the feature globally, use Detect Input Mode option in input configuration.

Custom Input Backend

Naninovel allows using custom input solutions, such as Rewired ↗, instead of Unity's built-in input system. The engine uses the default input system APIs only in a couple of virtual methods inside the InputManager class, and the references are conditionally compiled, ensuring that no compilation errors occur even if you remove the default input module.

To make the engine use a custom input solution, override the InputManager engine service and override the required virtual methods.