Class PostProcessEffectEditor<T>
The class to inherit from when designing custom effect editors.
Inherited Members
Namespace: UnityEditor.Rendering.PostProcessing
Syntax
public class PostProcessEffectEditor<T> : PostProcessEffectBaseEditor where T : PostProcessEffectSettings
Type Parameters
Name | Description |
---|---|
T | The effect type to create an editor for |
Methods
FindParameterOverride<TValue>(Expression<Func<T, TValue>>)
Find a serialized parameter override using an expression instead of a string. This is safer as it helps avoiding typos and make code refactoring easier.
Declaration
protected SerializedParameterOverride FindParameterOverride<TValue>(Expression<Func<T, TValue>> expr)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, TValue>> | expr | The expression to parse to reach the parameter override |
Returns
Type | Description |
---|---|
SerializedParameterOverride | A SerializedParameterOverride or |
Type Parameters
Name | Description |
---|---|
TValue | The serialized value type |
Examples
[Serializable]
public class MyEffect : PostProcessEffectSettings
{
public FloatParameter myParameter = new FloatParameter { value = 1f };
}
[PostProcessEditor(typeof(MyEffect))]
public class MyEffectEditor : PostProcessEffectEditor<MyEffect>
{
SerializedParameterOverride m_MyParameter;
public override void OnEnable()
{
m_MyParameter = FindParameterOverride(x => x.myParameter);
}
}
See Also
FindProperty<TValue>(Expression<Func<T, TValue>>)
Find a serialized property using an expression instead of a string. This is safer as it helps avoiding typos and make code refactoring easier.
Declaration
protected SerializedProperty FindProperty<TValue>(Expression<Func<T, TValue>> expr)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, TValue>> | expr | The expression to parse to reach the property |
Returns
Type | Description |
---|---|
SerializedProperty | A SerializedProperty or |
Type Parameters
Name | Description |
---|---|
TValue | The serialized value type |
Remarks
If you're trying to retrieve a SerializedParameterOverride, you should use FindParameterOverride<TValue>(Expression<Func<T, TValue>>) instead.
Examples
[Serializable]
public class MyEffect : PostProcessEffectSettings
{
public float myParameter = 1f;
}
[PostProcessEditor(typeof(MyEffect))]
public class MyEffectEditor : PostProcessEffectEditor<MyEffect>
{
SerializedProperty m_MyParameter;
public override void OnEnable()
{
m_MyParameter = FindProperty(x => x.myParameter);
}
}