docs
Systems
Infrastructure
InputSystem
Key Components

Managers and coordinators

InputManager

The central component. It runs once per frame through IUpdateable and does the following:

  • Reads mouse or touch state from Unity.
  • Feeds presses and releases to ClickDetector and DoubleClickDetector.
  • Tracks drag state against InputConstants.DragThreshold.
  • Sends one input event per recognized action through InputMessageBuilder.
  • Raycasts presses against the EventSystem and calls IInteractable.OnInteraction on the hit object and its parents.

It is created only by InputFlowController. Game code should not create it directly.

InputFlowController

The domain entry point. It extends FlowController so the command bus can route Input-domain commands to it. On Init it creates InputManager and registers it with the update system through UpdateCommandFactory. Its command handler currently logs a warning and ignores everything.

Gesture detectors

ClickDetector

A small, plain C# class. It records the press time, then on release it raises OnClick if the press was short enough. InputManager calls Reset when a drag starts, so a drag that happens to be quick does not produce a click.

DoubleClickDetector

A small, plain C# class. It stores the time of the first click. A second click within the window raises OnDoubleClick and clears the stored time. A slower click replaces the stored time. InputManager calls RegisterClick on each press and Reset when a drag starts.

Event and data classes

InputMessageBuilder

Builds input events. Callers call Create with a verb and a subject, add params, then call BuildMessage and Send. The builder always sets the subject param, so every input event carries one.

InputEventVerb and InputSubject

Enums that together describe each input event. The verb says what happened. The subject says what it is about.

InputParamKeys and InputKeyNames

InputParamKeys defines the typed keys that events use to carry data. Each key's name is built from InputKeyNames. Listeners read the values with Get or TryGet on the event's params.

InputConstants

Thresholds shared by the gesture detectors and InputManager: click time, double-click window, and drag distance.

Handler and listener interfaces

IInteractable

Implemented by components that should respond when the player presses their object. InputManager calls OnInteraction on every IInteractable found on the hit object or its parents, so a component can sit on a child object while the parent handles the interaction, or the reverse.

IInteractionResponder

Defined for components that want to respond after an interaction cycle completes.

Interaction between components

  1. InputFlowController creates InputManager on init and registers it for per-frame updates.
  2. InputManager reads platform input each frame and uses the detectors to classify gestures.
  3. Each recognized gesture is sent as an event built by InputMessageBuilder, using InputEventVerb, InputSubject, and the keys in InputParamKeys.
  4. Presses are also raycast against the EventSystem. Any IInteractable on the hit object or its parents is called directly, without going through the event system.
  5. Commands sent to the Input domain reach InputFlowController.HandleCommand, which currently ignores them.