| uid | input-system-screen-button-control |
|---|
To create an on-screen button:
- Add a UI
Buttonobject. - Add the
OnScreenButtoncomponent to it. - 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 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.
![The OnScreenButton component displays the Control Path value as rightShoulder [Gamepad].](/Unity-Technologies/InputSystem/raw/cae6b7b2f6a6a0afe0f3d7f2d5d5b9d26cce4e34/Packages/com.unity.inputsystem/Documentation%7E/Images/OnScreenButton.png)