| uid | input-system-simulate-touch |
|---|
You can simulate touch input from pointer devices such as mouse and pen devices in the following ways:
- Enable touch simulation in the Unity Editor.
- Add touch simulation to a GameObject.
- Enable touch simulation in startup code.
To enable touch simulation in the Unity Editor, perform the following steps:
- Open the Input Debugger (Window > Analysis > Input Debugger)
- Select the Options dropdown, and enable Simulate Touch Input From Mouse or Pen.
Add the TouchSimulation MonoBehaviour to a GameObject in your scene. TouchSimulation adds a Touchscreen device and automatically mirrors input on any Pointer device to the virtual touchscreen device.
Call TouchSimulation.Enable somewhere in your startup code:
void OnEnable()
{
TouchSimulation.Enable();
}