PostProcessingBehaviourEditor.cs
850 Bytes
using System;
using System.Linq.Expressions;
using UnityEngine.PostProcessing;
namespace UnityEditor.PostProcessing
{
[CustomEditor(typeof(PostProcessingBehaviour))]
public class PostProcessingBehaviourEditor : Editor
{
SerializedProperty m_Profile;
public void OnEnable()
{
m_Profile = FindSetting((PostProcessingBehaviour x) => x.profile);
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(m_Profile);
serializedObject.ApplyModifiedProperties();
}
SerializedProperty FindSetting<T, TValue>(Expression<Func<T, TValue>> expr)
{
return serializedObject.FindProperty(ReflectionUtils.GetFieldPath(expr));
}
}
}