Modifier functionsThe built-in functions a function field offers, and the operators they apply.

Built-in functions

Each is [Serializable] and derives from ModifierFunction<T>. The functions that compare, such as Clamp<T>, need a < operator registered for T. A [SerializeReference] ModifierFunction<T> field registers the operators of its type, and so does creating a built-in function in code.

Set<T>

sealed

Sets the value, in place of the value before this modifier.

Properties
T Value { get; set; }The value to set.

AtMost<T>

sealed

Caps the value before this modifier: a value above the maximum becomes the maximum. Apply throws InvalidOperationException when no < operator is registered for T.

Properties
T Max { get; set; }The highest value let through.

AtLeast<T>

sealed

Raises the value before this modifier: a value below the minimum becomes the minimum. Apply throws InvalidOperationException when no < operator is registered for T.

Properties
T Min { get; set; }The lowest value let through.

Clamp<T>

sealed

Keeps the value before this modifier between a lowest and a highest value. When the lowest value is above the highest, the result is the lowest. Apply throws InvalidOperationException when no < operator is registered for T.

Properties
T Min { get; set; }The lowest value let through.
T Max { get; set; }The highest value let through.

Abs<T>

sealed

Turns the value before this modifier into its absolute value: a value below the default, zero for numbers, is negated. Apply throws InvalidOperationException when no < or unary - operator is registered for T.

Snap

sealed

Rounds the value before this modifier to the nearest multiple of the step. Modifies a float.

Properties
float Step { get; set; }The multiple rounded to. Zero or less leaves the value unchanged. 1 by default.

Remap

sealed

Replaces the value before this modifier with the curve's value at that point. Modifies a float.

Properties
AnimationCurve Curve { get; set; }The mapping, from the value before this modifier to the value after it. Null leaves the value unchanged. A linear curve from (0, 0) to (1, 1) by default.

Blend functions

sealed

FloatBlend, Vector2Blend, Vector3Blend, Vector4Blend, ColorBlend and QuaternionBlend, labelled Blend in the dropdown. Each moves the value before this modifier toward a target, by a weight from 0 (unchanged) to 1 (the target), with the type's Lerp, or Quaternion.Slerp.

Properties
T Target { get; set; }The value moved toward. Quaternion.identity by default for QuaternionBlend.
float Weight { get; set; }How far toward the target: 0 keeps the value, 1 reaches the target. Apply clamps it between 0 and 1. 0.5 by default.

Scale functions

sealed

Vector2Scale, Vector3Scale and Vector4Scale, labelled Scale in the dropdown. Each multiplies the value before this modifier by a factor per axis.

Properties
T Factor { get; set; }The factor of each axis. One on every axis by default.

BinaryOperation<T, TOperand>

sealed

Applies a binary operator to the value before this modifier and the operand. A function field's dropdown lists one entry per operator and operand type the member's type has, such as Multiply (Single) on a Vector3. Apply throws InvalidOperationException when the operator is not registered for the two types.

Properties
BinaryOperator Operator { get; set; }The operator applied, chosen with the function in the dropdown.
TOperand Operand { get; set; }The right operand.

UnaryOperation<T>

sealed

Applies a unary operator to the value before this modifier. Apply throws InvalidOperationException when the operator is not registered for T.

Properties
UnaryOperator Operator { get; set; }The operator applied, chosen with the function in the dropdown.

Operators

BinaryOperator

enum

A C# binary operator, which BinaryOperation<T, TOperand> applies to the value before a modifier and an operand. Every C# binary operator a type can overload, except the comparisons.

Values
AddThe + operator.
SubtractThe - operator.
MultiplyThe * operator.
DivideThe / operator.
RemainderThe % operator.
AndThe & operator.
OrThe | operator.
XorThe ^ operator.
LeftShiftThe << operator.
RightShiftThe >> operator.

UnaryOperator

enum

A C# unary operator, which UnaryOperation<T> applies to the value before a modifier.

Values
PlusThe unary + operator.
NegateThe unary - operator.
NotThe ! operator.
ComplementThe ~ operator.
IncrementThe ++ operator.
DecrementThe -- operator.

Operators<T, TOperand>

static

The C# binary operators taking T and TOperand, for functions written once for every member type. Operators are registered for the type of each ModifierFunction<T> field and of each built-in function created in code, and only the operators the types have.

Static methods
T Apply(BinaryOperator @operator, T left, TOperand right)Returns left combined with right by the operator, converted to T as a compound assignment converts it. Throws InvalidOperationException when the operator is not registered for the two types, and ArgumentOutOfRangeException when operator is not a defined value.
bool Has(BinaryOperator @operator)Returns whether the operator is registered for the two types.

Operators<T>

static

The C# unary operators of T, for functions written once for every member type. Operators are registered for the type of each ModifierFunction<T> field and of each built-in function created in code, and only the operators the type has.

Static methods
T Apply(UnaryOperator @operator, T value)Returns the operator applied to value, converted to T as a compound assignment converts it. Throws InvalidOperationException when the operator is not registered for T, and ArgumentOutOfRangeException when operator is not a defined value.
bool Has(UnaryOperator @operator)Returns whether the operator is registered for T.