# Mobile Input and Touch
[[Input System]] already covers actions, control schemes, `PlayerInput`, runtime rebinding, and a remappable player (parts 1–6, package **1.20.x**). This series adds what that course left on the table: **touch** as a first-class scheme, **Enhanced Touch** polling, **on-screen sticks and buttons**, and the Editor **Device Simulator** - so a classroom slice can be held as well as keyed.
**Target:** Unity **6000.5+**. Input System **1.20.x** (this series documents against the official **1.20.1** manuals and Scripting API for On-Screen Controls, Enhanced Touch, and touch bindings). Confirm the version Package Manager resolves. For Quest / XR input, stay on the existing [[4. UI Input and XR Input]] note; this series is phones and tablets (and Editor simulation of them).
> [!warning] Code not compiled
> APIs were checked against the Input System **1.20.1** manuals (create on-screen stick / button, touch polling, bind touch input) and Scripting API (`OnScreenStick`, `OnScreenButton`, `EnhancedTouchSupport`, `EnhancedTouch.Touch`), plus the Unity **6000.5** Device Simulator introduction. **No script in this series has been compiled in the Editor or play-tested on a physical device.**
> [!note] Verification status
> **Verified (2026-11-10):** `OnScreenStick` on a uGUI `Image` with `controlPath` to a `Vector2Control` (for example `<Gamepad>/leftStick`); `movementRange`; `useIsolatedInputActions` to stop `PlayerInput` auto-switch from cancelling the stick; `OnScreenButton` on a uGUI `Button` with a `ButtonControl` path (for example `<Gamepad>/buttonSouth`); `EnhancedTouchSupport.Enable()` / `Disable()` before polling `Touch.activeTouches`; official warning not to poll `Touchscreen` state inside `Update` if you meant Enhanced Touch; Device Simulator is **built into** the Unity 6 Editor (Play Mode only; mouse → a **single** touch; **no multitouch**; no performance or rendering simulation; no `UNITY_IOS` defines; no gyroscope).
> **Not verified:** every `OnScreenStick.Behaviour` enum value other than the official remarks' `ExactPositionWithDynamicOrigin` (confirm the rest in 1.20.1 IntelliSense / Inspector); physical-device multitouch and pressure; a later Input System than 1.20.x if Package Manager resolves one.
## Parts
| # | Note | Covers |
|---|---|---|
| 1 | [[1. Touch Schemes on the Existing Input System]] | A Touch (or Gamepad-via-stick) scheme; bindings; what not to redo |
| 2 | [[2. Enhanced Touch Polling]] | `EnhancedTouchSupport`, `Touch.activeTouches`, fingers vs touches |
| 3 | [[3. On-Screen Stick and Isolated Actions]] | `OnScreenStick`, `OnScreenButton`, `useIsolatedInputActions` |
| 4 | [[4. Device Simulator and Safe Area]] | Simulator limits, orientation, `Screen.safeArea` |
| 5 | [[5. Worked Example On-Screen Stick Player]] | Overlay a stick on the remappable player |
| 6 | [[6. Mobile Input Pitfalls]] | Auto-switch jitter, Simulator multitouch, EventSystem |
## Design lens (Level Up!)
Level 7 in [[Level Up! (Review)]] is control and feel: a virtual stick is a **control**, not a decoration. If the stick fights `PlayerInput` and jumps back to center, the game is unplayable on a phone no matter how good the keyboard build was. Context-sensitive prompts on a touch screen also need a thumb-sized target ([[Context-Sensitive Prompts and Onboarding]], [[Accessibility]]).
## Patterns used (Game Programming Patterns)
- **Adapter** - `OnScreenStick` adapts pointer drags into a Gamepad (or other) `Vector2` so existing actions keep working.
- **Component** - stick, button, and `PlayerInput` are scene objects; do not hide a second action asset in a script unless you mean to.
- **State** - Keyboard&Mouse vs Gamepad vs Touch schemes; only one set of bindings should drive movement at a time.
See [[Game Programming Patterns (Review)]].
## Related (existing)
- [[Input System]] / [[1. Package Setup and Action Foundations]] / [[2. Control Schemes Devices and Consumption Patterns]] / [[3. Runtime Rebinding]] / [[4. UI Input and XR Input]] / [[5. Worked Example Remappable Player]] / [[6. Pitfalls]]
- [[Accessibility]] - remapping recap, target size
- [[Context-Sensitive Prompts and Onboarding]]
- [[Async Code]] only if you load prompts or a settings menu asynchronously; input itself stays in `Update` / callbacks
- [[Level Up! (Review)]] Level 7
## Sources
- Create an on-screen stick (1.20.1): https://docs.unity3d.com/Packages/
[email protected]/manual/create-on-screen-stick-control.html
- Create an on-screen button (1.20.1): https://docs.unity3d.com/Packages/
[email protected]/manual/create-on-screen-button-control.html
- `OnScreenStick` API (1.20.1): https://docs.unity3d.com/Packages/
[email protected]/api/UnityEngine.InputSystem.OnScreen.OnScreenStick.html
- Touch polling (1.20.1): https://docs.unity3d.com/Packages/
[email protected]/manual/touch-polling.html
- Bind touch input (1.20.1): https://docs.unity3d.com/Packages/
[email protected]/manual/bind-touch-input.html
- Device Simulator introduction (6000.5): https://docs.unity3d.com/6000.5/Documentation/Manual/device-simulator-introduction.html
- `Screen.safeArea` (6000.5): https://docs.unity3d.com/6000.5/Documentation/ScriptReference/Screen-safeArea.html