Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Input for Android devices

Understand how to detect and handle user input on different types of Android devices.
Read time 2 minutesLast updated 7 days ago

Mobile devices are the primary target for Android applications. Unity provides an Input System package to handle user input on Android devices. This input solution is enabled by default for new projects.
Note
Unity also supports the legacy Input Manager for existing projects. You can choose between the two input solutions through Android Player settings > Other Settings > Configuration > Active Input Handling.
The Input System package supports a variety of input devices on the Android platform, including mouse, keyboard, pen, touchscreen, sensors, joystick, and gamepads. For more information, refer to Supported input devices in the Input System package documentation.
For additional input features on Android, refer to the following sections:

On-screen keyboard support

Android devices automatically display an on-screen touchscreen keyboard when users select editable UI elements, such as Input Fields created using UGUI, or TextField controls created using UI Toolkit, or IMGUI. Unity automatically activates the Android keyboard and handles input from it. If you want to manually activate and configure the Android touchscreen keyboard behavior, refer to Mobile Keyboard.

Gamepad and rumble support

Unity provides gamepad support allowing users to use physical controllers when playing your Android games. You can configure the level of gamepad support in the Android Player settings > Other Settings > Configuration > Android Gamepad Support Level. To handle gamepad input, use the Input System package APIs.
Unity also supports rumble with gamepad controllers on Android devices, allowing controller vibration in response to in-game events and improving the overall gameplay experience. To implement rumble support, use the Input System package APIs.
Notes:
  • Rumble support varies depending on the Android OS version.
  • The Input System package APIs support rumble with gamepad controllers. If you want to trigger vibration of the Android device itself, use the
    Handheld.Vibrate
    API.

Additional resources