The Input System turns raw mouse and touch activity into typed input events. It detects presses, releases, holds, movement, clicks, double-clicks, and drags, and publishes each one on the Input domain with the screen position attached.
Purpose in SaffronLibrary
The Input System sits in _Core/Infrastructure and is the single place where pointer and touch input is read from Unity. Other systems never read Unity input directly. They don't listen to input events either. Instead, the UI system turns them into UI events, which other systems listen to.
Key responsibilities
- Gesture recognition:
InputManagerreads platform input each frame. It uses touch on Android and the mouse everywhere else. It also classifies gestures as clicks, double-clicks, and drags usingClickDetectorandDoubleClickDetector. - Event publication: Each recognized action is sent as an input event on the Input domain. Each event carries a verb from
InputEventVerb, a subject fromInputSubject, and the screen position inInputParamKeys.ScreenPosition. - Hit testing: Each press is raycast against the Unity
EventSystem. AnyIInteractablecomponents on the hit object and its parents are told to interact.
Who should use it
- Gameplay and UI developers who need to respond to clicks, drags, or taps.
- Developers who add interactable world or UI objects that should respond to presses through
IInteractable.
The Input System does not handle commands yet. Any command sent to the Input domain is ignored with a warning.