Class Vector2Composite | Package Manager UI website
docs.unity.cn
    Show / Hide Table of Contents

    Class Vector2Composite

    A 2D planar motion vector computed from an up+down button pair and a left+right button pair.

    Inheritance
    System.Object
    InputBindingComposite
    InputBindingComposite<Vector2>
    Vector2Composite
    Inherited Members
    InputBindingComposite<Vector2>.valueType
    InputBindingComposite<Vector2>.valueSizeInBytes
    InputBindingComposite<Vector2>.ReadValue(InputBindingCompositeContext, Void*, Int32)
    InputBindingComposite<Vector2>.ReadValueAsObject(InputBindingCompositeContext)
    Namespace: UnityEngine.InputSystem.Composites
    Syntax
    public class Vector2Composite : InputBindingComposite<Vector2>
    Remarks

    This composite allows to grab arbitrary buttons from a device and arrange them in a D-Pad like configuration. Based on button presses, the composite will return a normalized direction vector (normalization can be turned off via normalize).

    Opposing motions cancel each other out. Meaning that if, for example, both the left and right horizontal button are pressed, the resulting horizontal movement value will be zero.

    Fields

    down

    Binding for the button that down (i.e. (0,-1)) direction of the vector.

    Declaration
    public int down
    Field Value
    Type Description
    System.Int32
    Remarks

    This property is automatically assigned by the input system.

    left

    Binding for the button that left (i.e. (-1,0)) direction of the vector.

    Declaration
    public int left
    Field Value
    Type Description
    System.Int32
    Remarks

    This property is automatically assigned by the input system.

    normalize

    If true (default), then the resulting vector will be normalized. Otherwise, diagonal vectors will have a magnitude > 1 (i.e. will be new Vector2(1,1), for example, instead of new Vector2(1,1).normalized).

    Declaration
    public bool normalize
    Field Value
    Type Description
    System.Boolean

    right

    Binding for the button that right (i.e. (1,0)) direction of the vector.

    Declaration
    public int right
    Field Value
    Type Description
    System.Int32
    Remarks

    This property is automatically assigned by the input system.

    up

    Binding for the button that up (i.e. (0,1)) direction of the vector.

    Declaration
    public int up
    Field Value
    Type Description
    System.Int32
    Remarks

    This property is automatically assigned by the input system.

    Methods

    EvaluateMagnitude(ref InputBindingCompositeContext)

    Declaration
    public override float EvaluateMagnitude(ref InputBindingCompositeContext context)
    Parameters
    Type Name Description
    InputBindingCompositeContext context
    Returns
    Type Description
    System.Single
    Overrides
    InputBindingComposite.EvaluateMagnitude(ref InputBindingCompositeContext)

    ReadValue(ref InputBindingCompositeContext)

    Declaration
    public override Vector2 ReadValue(ref InputBindingCompositeContext context)
    Parameters
    Type Name Description
    InputBindingCompositeContext context
    Returns
    Type Description
    Vector2
    Overrides
    UnityEngine.InputSystem.InputBindingComposite<Vector2>.ReadValue(UnityEngine.InputSystem.InputBindingCompositeContext)
    Back to top Copyright © 2019 Unity Technologies
    Generated by DocFX