Class ParameterOverride<T>
The base typed class for all parameter override types.
Inherited Members
Namespace: UnityEngine.Rendering.PostProcessing
Syntax
public class ParameterOverride<T> : ParameterOverride
Type Parameters
Name | Description |
---|---|
T | The type of value to store in this |
Remarks
Due to limitations with the serialization system in Unity you shouldn't use this class directly. Use one of the pre-flatten types (like FloatParameter or make your own by extending this class.
Examples
This sample code shows how to make a custom parameter holding a float
.
[Serializable]
public sealed class FloatParameter : ParameterOverride<float>
{
public override void Interp(float from, float to, float t)
{
value = from + (to - from) * t;
}
}
Constructors
ParameterOverride()
Creates a ParameterOverride
with a default value and
overrideState set to false
.
Declaration
public ParameterOverride()
ParameterOverride(T)
Creates a ParameterOverride
with a given value and
overrideState set to false
.
Declaration
public ParameterOverride(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to set this parameter to |
ParameterOverride(T, Boolean)
Creates a ParameterOverride
with a given value and override state.
Declaration
public ParameterOverride(T value, bool overrideState)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to set this parameter to |
Boolean | overrideState | The override state for this value |
Fields
value
The value stored in this parameter.
Declaration
public T value
Field Value
Type | Description |
---|---|
T |
Methods
GetHash()
Returns the computed hash code for this parameter.
Declaration
public override int GetHash()
Returns
Type | Description |
---|---|
Int32 | A computed hash code |
Overrides
Interp(T, T, Single)
Interpolates between two values given an interpolation factor t
.
Declaration
public virtual void Interp(T from, T to, float t)
Parameters
Type | Name | Description |
---|---|---|
T | from | The value to interpolate from |
T | to | The value to interpolate to |
Single | t | An interpolation factor (generally in range |
Remarks
By default this method does a "snap" interpolation, meaning it will return the value
to
if t
is higher than 0, from
otherwise.
Override(T)
Sets the value for this parameter to x
and mark the override state
to true
.
Declaration
public void Override(T x)
Parameters
Type | Name | Description |
---|---|---|
T | x |
Operators
Implicit(ParameterOverride<T> to T)
Implicit conversion between ParameterOverride<T> and its value type.
Declaration
public static implicit operator T(ParameterOverride<T> prop)
Parameters
Type | Name | Description |
---|---|---|
ParameterOverride<T> | prop | The parameter to implicitly cast |
Returns
Type | Description |
---|---|
T | A value of type |