![]() OnScreenStick starts the movement of the stick Control when it receives a pointer-down ( IPointerDownHandler.OnPointerDown) event, and stops it when it receives a pointer-up ( IPointerUpHandler.OnPointerUp) event. The OnScreenStick component requires the target Control to be a Vector2 Control. The type of device referenced by the control path determines the type of virtual device created by the component. Set the Control Path to refer to a Vector2Control (for example, /leftStick).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 requires the target Control to be a Button Control. Set the Control Path to refer to a ButtonControl (for example, /buttonSouth).Add the OnScreenButton component to it.Note: This design allows you to use on-screen Controls to create input for arbitrary Input Devices, in addition to joysticks and gamepads. To query the Control (and, implicitly, the Device) that an on-screen Control feeds into, you can use the ntrol property. When disabled, the Input System automatically removes the Devices again. This happens automatically when the components are enabled. For example, if one on-screen button references /buttonSouth and another on-screen button references /a, the Input System creates both a Gamepad and a Keyboard. The Input System creates one Input Device for each distinct type of Device the Controls reference. The collection of on-screen Controls present in a Scene forms one or more Input Devices. For example, the following on-screen button reports input as the right shoulder button of a gamepad: On-screen Controls take care of the interaction logic and of setting up and generating input from interactions.Įach on-screen Control uses a Control path to reference the Control that it should report input as. ![]() It's up to you to set up the visual aspect of a Control (for example, by adding a sprite or UI component to the GameObject). Note: On-screen Controls don't have a predefined visual representation. You can implement custom Controls by extending the base OnScreenControl class (see documentation on writing custom on screen Controls to learn more). There are currently two Control types implemented out of the box: buttons and sticks. ![]() The most prominent example is the use of stick and button widgets on touchscreens to emulate a joystick or gamepad. ![]() You can use on-screen Controls to simulate Input Devices with UI widgets that the user interacts with on the screen. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |