docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Simulate touches

    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.

    Enable touch simulation in the Unity Editor

    To enable touch simulation in the Unity Editor, perform the following steps:

    1. Open the Input Debugger (Window > Analysis > Input Debugger)
    2. Select the Options dropdown, and enable Simulate Touch Input From Mouse or Pen.

    Add touch simulation to a GameObject

    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.

    Enable touch simulation in startup code

    Call TouchSimulation.Enable somewhere in your startup code:

    
       void OnEnable()
        {
            TouchSimulation.Enable();
        }
    
    
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)