docs.unity.cn
    Show / Hide Table of Contents

    Class ScaleVector2Processor

    Scale the components of a Vector2 by constant factors.

    Inheritance
    Object
    InputProcessor
    InputProcessor<Vector2>
    ScaleVector2Processor
    Inherited Members
    InputProcessor<Vector2>.ProcessAsObject(Object, InputControl)
    InputProcessor<Vector2>.Process(Void*, Int32, InputControl)
    InputProcessor.cachingPolicy
    Namespace: UnityEngine.InputSystem.Processors
    Syntax
    public class ScaleVector2Processor : InputProcessor<Vector2>
    Remarks

    This processor is registered (see RegisterProcessor<T>(String)) under the name "scaleVector2".

    // Double the length of the vector produced by leftStick on gamepad.
    myAction.AddBinding("<Gamepad>/leftStick").WithProcessor("scaleVector2(x=2,y=2)");

    Fields

    x

    Scale factor to apply to the vector's x axis. Defaults to 1.

    Declaration
    [Tooltip("Scale factor to multiply the incoming Vector2's X component by.")]
    public float x
    Field Value
    Type Description
    Single

    y

    Scale factor to apply to the vector's y axis. Defaults to 1.

    Declaration
    [Tooltip("Scale factor to multiply the incoming Vector2's Y component by.")]
    public float y
    Field Value
    Type Description
    Single

    Methods

    Process(Vector2, InputControl)

    Return value scaled by x and y.

    Declaration
    public override Vector2 Process(Vector2 value, InputControl control)
    Parameters
    Type Name Description
    Vector2 value

    Input value.

    InputControl control

    Ignored.

    Returns
    Type Description
    Vector2

    Scaled vector.

    Overrides
    UnityEngine.InputSystem.InputProcessor<UnityEngine.Vector2>.Process(UnityEngine.Vector2, UnityEngine.InputSystem.InputControl)

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    String
    Overrides
    Object.ToString()

    See Also

    ScaleProcessor
    ScaleVector3Processor
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Monday, July 17, 2023