namespace UnityEngine.InputSystem.Processors { /// /// Scale the components of a by constant factors. /// /// /// This processor is registered (see ) 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)"); /// /// /// /// /// public class ScaleVector2Processor : InputProcessor { /// /// Scale factor to apply to the vector's x axis. Defaults to 1. /// [Tooltip("Scale factor to multiply the incoming Vector2's X component by.")] public float x = 1; /// /// Scale factor to apply to the vector's y axis. Defaults to 1. /// [Tooltip("Scale factor to multiply the incoming Vector2's Y component by.")] public float y = 1; /// /// Return scaled by and . /// /// Input value. /// Ignored. /// Scaled vector. public override Vector2 Process(Vector2 value, InputControl control) { return new Vector2(value.x * x, value.y * y); } /// public override string ToString() { return $"ScaleVector2(x={x},y={y})"; } } }