chenxin
2020-10-27 e33d0e85cf5d01e953d95197488eeffc67835f3a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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));
        }
    }
}