docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Create an on-screen button control

    To create an on-screen button:

    1. Add a UI Button object.
    2. Add the OnScreenButton component to it.
    3. Set the controlPath to refer to a ButtonControl (for example, <Gamepad>/buttonSouth). The type of device referenced by the control path determines the type of virtual device created by the component.

    The OnScreenButton component displays the Control Path value as rightShoulder [Gamepad].

    The OnScreenButton component requires the target control to be a Button control. OnScreenButton sets the target control value to 1 when it receives a pointer-down (IPointerDownHandler.OnPointerDown) event, or 0 when it receives a pointer-up (IPointerUpHandler.OnPointerUp) event.

    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)