Files
JJBB/Assets/Plugins/PostProcessing/Editor/PostProcessingBehaviourEditor.cs

32 lines
819 B
C#
Raw Permalink Normal View History

2024-08-23 15:49:34 +08:00
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));
}
}
}