## Input type detection
In cross‑platform development, it's important that you determine and respond to the **primary** input type a player is using, normally to ensure that [UI elements](../ui/index.md#ui-objects) like on‑screen buttons and menus work elegantly across devices.
For example, a touch‑enabled device assumes touch is the default input and that touch buttons may appear for actions, but if a player connects an additional bluetooth keyboard/mouse or gamepad, you can assume they want to switch to that as the **primary** input type and possibly use touch as a backup input for on‑screen UI. The read‑only `Class.UserInputService.PreferredInput` property is a convenient way to test for and adapt to multiple input types across multiple device types, based on anticipated player behavior.
| Real-World Scenario | `PreferredInput` |
|---|---|
| Player is using a phone with no other connected input devices; no possibility of an input type change. | `Enum.PreferredInput|Touch` |
| Player is using a mobile device with a bluetooth keyboard & mouse connected, but no gamepad is connected. | `Enum.PreferredInput|KeyboardAndMouse` |
| Player is using a tablet with a bluetooth gamepad connected, but no keyboard or mouse is connected. | `Enum.PreferredInput|Gamepad` |
| Player is using an Xbox or PlayStation with a bluetooth keyboard & mouse connected and has most recently interacted with the keyboard or mouse. | `Enum.PreferredInput|KeyboardAndMouse` |
| Player is on a Windows or Mac PC with a gamepad connected and has most recently interacted with the gamepad. | `Enum.PreferredInput|Gamepad` |