Class OnScreenStick
A stick control displayed on screen and moved around by touch or other pointer input.
Implements
Inherited Members
Namespace: UnityEngine .InputSystem .OnScreen
Assembly: Unity.InputSystem.dll
Syntax
[AddComponentMenu("Input/On-Screen Stick")]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.inputsystem@1.13/manual/OnScreen.html#on-screen-sticks")]
public class OnScreenStick : OnScreenControl, IPointerDownHandler, IPointerUpHandler, IDragHandler, IEventSystemHandler
Remarks
The On
To avoid this situation, set the use
Properties
behaviour
Defines how the onscreen stick will move relative to it's origin and the press position.
Declaration
public OnScreenStick.Behaviour behaviour { get; set; }
Property Value
Type | Description |
---|---|
On |
controlPathInternal
Accessor for the control
Declaration
protected override string controlPathInternal { get; set; }
Property Value
Type | Description |
---|---|
string |
Overrides
Remarks
Moving the definition of how the control path is stored into subclasses allows them to
apply their own Input
dynamicOriginRange
Defines the circular region where the onscreen control may have it's origin placed.
Declaration
public float dynamicOriginRange { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
This only applies if behaviour is set to Exact
movementRange
The distance from the onscreen control's center of origin, around which the control can move.
Declaration
public float movementRange { get; set; }
Property Value
Type | Description |
---|---|
float |
useIsolatedInputActions
Prevents stick interactions from getting cancelled due to device switching.
Declaration
public bool useIsolatedInputActions { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This property is useful for scenarios where the active device switches automatically
based on the most recently actuated device. A common situation where this happens is
when using a Player
In isolated mode, the actions driving the stick are not cancelled because they are unique Input Action instances that don't share state with any others.
Methods
OnDrag(PointerEventData)
Callback to handle OnDrag UI events.
Declaration
public void OnDrag(PointerEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
Pointer |
eventData |
OnPointerDown(PointerEventData)
Callback to handle OnPointerDown UI events.
Declaration
public void OnPointerDown(PointerEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
Pointer |
eventData |
OnPointerUp(PointerEventData)
Callback to handle OnPointerUp UI events.
Declaration
public void OnPointerUp(PointerEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
Pointer |
eventData |