Skip to main content

Dialogue Input Service

Description

Wraps Unity's Input System to provide dialogue-specific input handling. Loads the Dialogue action map from an InputActionAsset, caches actions by name, and provides methods to check input state and resolve per-device display labels.

Mouse interaction with options does not go through the action map. The option views call RaiseOptionClicked and RaiseOptionHovered, which fire the corresponding events. See Input System.

Interface

Type
IDialogueInputService
IGameInputProvider
IDisposable

Inherits

Type
N/A

Events

NameTypeDescription
OnOptionClickedAction<int>Raised when a dialogue option is clicked by mouse.
OnOptionHoveredAction<int>Raised when a dialogue option is hovered by mouse.
OnDeviceModeChangedAction<InputDeviceMode>Raised when auto-detection switches between keyboard and gamepad.

Public Methods

NameParametersReturn TypeDescription
CreateFromSettingsModuleSettingsDialogueInputServiceStatic factory that creates and configures the service from module settings.
WasPressedstring actionNameboolReturns true if the named action was pressed this frame.
ReadLookDeltaN/AVector2Reads the look delta, used by the camera input policy to detect the player looking away.
GetDisplayLabelstring actionNamestringReturns the human-readable binding label for the current device mode.
EnableN/AvoidEnables the dialogue action map.
DisableN/AvoidDisables the dialogue action map.
RaiseOptionClickedint indexvoidRaises OnOptionClicked. Called by the option views on mouse click.
RaiseOptionHoveredint indexvoidRaises OnOptionHovered. Called by the option views on mouse hover.
DisposeN/AvoidUnsubscribes from Input System callbacks and releases the action map.

CreateFromSettings takes the dialogue ModuleSettings (referred to in source through the DialogueSettings alias). If settings supply no InputActionAsset, it falls back to Resources/DIALOGUE-SYSTEM/Input/DialogueInputActions.