Class Vector2Control
A floating-point 2D vector control composed of two AxisControls.
Inherited Members
Namespace: UnityEngine.InputSystem.Controls
Syntax
public class Vector2Control : InputControl<Vector2>
Remarks
An example is position.
Debug.Log(string.Format("Mouse position x={0} y={1}",
Mouse.current.position.x.ReadValue(),
Mouse.current.position.y.ReadValue()));
Normalization is not implied. The X and Y coordinates can be in any range or units.
Constructors
Vector2Control()
Default-initialize the control.
Declaration
public Vector2Control()
Properties
x
Horizontal position of the control.
Declaration
public AxisControl x { get; set; }
Property Value
Type | Description |
---|---|
AxisControl | Control representing horizontal motion input. |
y
Vertical position of the control.
Declaration
public AxisControl y { get; set; }
Property Value
Type | Description |
---|---|
AxisControl | Control representing vertical motion input. |
Methods
CalculateOptimizedControlDataType()
Declaration
protected override FourCC CalculateOptimizedControlDataType()
Returns
Type | Description |
---|---|
FourCC |
Overrides
EvaluateMagnitude(Void*)
Compute an absolute, normalized magnitude value that indicates the extent to which the control is actuated in the given state.
Declaration
public override float EvaluateMagnitude(void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
Void* | statePtr | State containing the control's stateBlock. |
Returns
Type | Description |
---|---|
Single | Amount of actuation of the control or -1 if it cannot be determined. |
Overrides
See Also
FinishSetup()
Declaration
protected override void FinishSetup()
Overrides
UnityEngine.InputSystem.InputControl<UnityEngine.Vector2>.FinishSetup()
ReadUnprocessedValueFromState(Void*)
Declaration
public override Vector2 ReadUnprocessedValueFromState(void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
Void* | statePtr |
Returns
Type | Description |
---|---|
Vector2 |
Overrides
UnityEngine.InputSystem.InputControl<UnityEngine.Vector2>.ReadUnprocessedValueFromState(System.Void*)
WriteValueIntoState(Vector2, Void*)
Declaration
public override void WriteValueIntoState(Vector2 value, void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | |
Void* | statePtr |
Overrides
UnityEngine.InputSystem.InputControl<UnityEngine.Vector2>.WriteValueIntoState(UnityEngine.Vector2, System.Void*)