Class ClampProcessor
Clamp a floating-point input to between min and max. This is equivalent
to Mathf.Clamp(value, min, max)
.
Inherited Members
Namespace: UnityEngine.InputSystem.Processors
Assembly: Unity.InputSystem.dll
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 |
---|---|
float |
min
Minimum value (inclusive!) of the accepted value range.
Declaration
public float min
Field Value
Type | Description |
---|---|
float |
Methods
Process(float, InputControl)
Declaration
public override float Process(float value, InputControl control)
Parameters
Type | Name | Description |
---|---|---|
float | value | Input value. |
InputControl | control | Ignored. |
Returns
Type | Description |
---|---|
float | Clamped value. |
Overrides
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |