Class DpadControl
A control made up of four discrete, directional buttons. Forms a vector but can also be addressed as individual buttons.
Inherited Members
Namespace: UnityEngine.InputSystem.Controls
Syntax
public class DpadControl : Vector2Control
Remarks
Is stored as four bits by default.
The vector that is aggregated from the button states is normalized. I.e.
even if pressing diagonally, the vector will have a length of 1 (instead
of reading something like (1,1) for example).
Constructors
DpadControl()
Declaration
public DpadControl()
Properties
down
The button representing the vertical downwards state of the D-Pad.
Declaration
public ButtonControl down { get; set; }
Property Value
| Type | Description | 
|---|---|
| ButtonControl | 
left
The button representing the horizontal left state of the D-Pad.
Declaration
public ButtonControl left { get; set; }
Property Value
| Type | Description | 
|---|---|
| ButtonControl | 
right
The button representing the horizontal right state of the D-Pad.
Declaration
public ButtonControl right { get; set; }
Property Value
| Type | Description | 
|---|---|
| ButtonControl | 
up
Declaration
public ButtonControl up { get; set; }
Property Value
| Type | Description | 
|---|---|
| ButtonControl | 
Methods
FinishSetup()
Declaration
protected override void FinishSetup()
Overrides
MakeDpadVector(Boolean, Boolean, Boolean, Boolean, Boolean)
Create a direction vector from the given four button states.
Declaration
public static Vector2 MakeDpadVector(bool up, bool down, bool left, bool right, bool normalize = true)
Parameters
| Type | Name | Description | 
|---|---|---|
| Boolean | up | Whether button representing the up direction is pressed.  | 
| Boolean | down | Whether button representing the down direction is pressed.  | 
| Boolean | left | Whether button representing the left direction is pressed.  | 
| Boolean | right | Whether button representing the right direction is pressed.  | 
| Boolean | normalize | Whether to normalize the resulting vector. If this is false, vectors in the diagonal directions will have a magnitude of greater than 1. For example, up-left will be (-1,1).  | 
Returns
| Type | Description | 
|---|---|
| Vector2 | A 2D direction vector.  | 
MakeDpadVector(Single, Single, Single, Single)
Create a direction vector from the given axis states.
Declaration
public static Vector2 MakeDpadVector(float up, float down, float left, float right)
Parameters
| Type | Name | Description | 
|---|---|---|
| Single | up | Axis value representing the up direction.  | 
| Single | down | Axis value representing the down direction.  | 
| Single | left | Axis value representing the left direction.  | 
| Single | right | Axis value representing the right direction.  | 
Returns
| Type | Description | 
|---|---|
| Vector2 | A 2D direction vector.  | 
ReadUnprocessedValueFromState(Void*)
Declaration
public override Vector2 ReadUnprocessedValueFromState(void *statePtr)
Parameters
| Type | Name | Description | 
|---|---|---|
| Void* | statePtr | 
Returns
| Type | Description | 
|---|---|
| Vector2 | 
Overrides
WriteValueIntoState(Vector2, Void*)
Declaration
public override void WriteValueIntoState(Vector2 value, void *statePtr)
Parameters
| Type | Name | Description | 
|---|---|---|
| Vector2 | value | |
| Void* | statePtr |