docs.unity3d.com
    Show / Hide Table of Contents

    Class ClampProcessor

    Clamp a floating-point input to between min and max. This is equivalent to Mathf.Clamp(value, min, max).

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

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

    Note that no normalization is performed. If you want to re-normalize the input value after clamping, add a NormalizeProcessor. Alternatively, add a AxisDeadzoneProcessor which both clamps and normalizes.

    // Bind to right trigger on gamepad such that the value never drops below 0.3 and never goes // above 0.7. new InputAction(binding: "<Gamepad>/rightTrigger", processors: "clamp(min=0.3,max=0.7)");

    Fields

    max

    Maximum value (inclusive!) of the accepted value range.

    Declaration
    public float max
    Field Value
    Type Description
    Single

    min

    Minimum value (inclusive!) of the accepted value range.

    Declaration
    public float min
    Field Value
    Type Description
    Single

    Methods

    Process(Single, InputControl)

    Clamp value to the range of min and max.

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

    Input value.

    InputControl control

    Ignored.

    Returns
    Type Description
    Single

    Clamped value.

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

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    String
    In This Article
    • Fields
      • max
      • min
    • Methods
      • Process(Single, InputControl)
      • ToString()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023