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
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)
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 |