inputEmulation
Specifies whether the target device, Unity, or neither converts mouse and touchpad input into touch input in the Android application.
Read time 1 minuteLast updated 3 days ago
Definition
- Type: Property
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
public static AndroidInputEmulationMode inputEmulation { get; set; }
Remarks
Some Android devices, such as ChromeOS devices, Googlebook devices, and Google Play Games on PC, convert mouse and touchpad input into touchscreen input for applications that don't declare the feature in the Android App Manifest. Googlebook devices convert the input only for applications in the game category, as set in PlayerSettings.Android.appCategory.
android.hardware.type.pcUse this property to let the device convert the input, to make Unity convert the input into touch input on every device, or to receive mouse and touchpad input unchanged. The default value is AndroidInputEmulationMode.Platform.
AndroidInputEmulationMode.Platform doesn't change the manifest. AndroidInputEmulationMode.Engine and AndroidInputEmulationMode.None add to the manifest. Unity declares this feature as not required with , so Google Play still lists the application on devices without this feature.
android.hardware.type.pcandroid:required="false"To use AndroidInputEmulationMode.Engine, set Active Input Handling to Input System Package (New). If Active Input Handling is Input Manager (Old) or Both, Unity logs a warning when you build and doesn't convert mouse and touchpad input into touch input.
Additional Resources: AndroidInputEmulationMode
The following code example demonstrates AndroidInputEmulationMode.Engine, which lets Unity convert mouse and touchpad input into touchscreen input on every Android device.
Examples
using UnityEngine;using UnityEditor;public class InputEmulationSample : MonoBehaviour{ [MenuItem("Build/Use Unity Input Emulation")] public static void UseUnityInputEmulation() { // Unity converts mouse and touchpad input into touch input on every Android device. PlayerSettings.Android.inputEmulation = AndroidInputEmulationMode.Engine; }}