You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
819 B

  1. using System;
  2. using System.Linq.Expressions;
  3. using UnityEngine.PostProcessing;
  4. namespace UnityEditor.PostProcessing
  5. {
  6. [CustomEditor(typeof(PostProcessingBehaviour))]
  7. public class PostProcessingBehaviourEditor : Editor
  8. {
  9. SerializedProperty m_Profile;
  10. public void OnEnable()
  11. {
  12. m_Profile = FindSetting((PostProcessingBehaviour x) => x.profile);
  13. }
  14. public override void OnInspectorGUI()
  15. {
  16. serializedObject.Update();
  17. EditorGUILayout.PropertyField(m_Profile);
  18. serializedObject.ApplyModifiedProperties();
  19. }
  20. SerializedProperty FindSetting<T, TValue>(Expression<Func<T, TValue>> expr)
  21. {
  22. return serializedObject.FindProperty(ReflectionUtils.GetFieldPath(expr));
  23. }
  24. }
  25. }