Class BaseEditor<T> | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class BaseEditor<T>

    Small wrapper on top of to ease the access of the underlying component and its serialized fields.

    Inheritance
    System.Object
    BaseEditor<T>
    Namespace: UnityEditor.Rendering.PostProcessing
    Syntax
    public class BaseEditor<T> : Editor where T : MonoBehaviour
    Type Parameters
    Name Description
    T

    The type of the target component to make an editor for

    Examples
    public class MyMonoBehaviour : MonoBehaviour
    {
        public float myProperty = 1.0f;
    }
    
    [CustomEditor(typeof(MyMonoBehaviour))]
    public sealed class MyMonoBehaviourEditor : BaseEditor<MyMonoBehaviour>
    {
        SerializedProperty m_MyProperty;
    
        void OnEnable()
        {
            m_MyProperty = FindProperty(x => x.myProperty);
        }
    
        public override void OnInspectorGUI()
        {
            EditorGUILayout.PropertyField(m_MyProperty);
        }
    }

    Properties

    m_Target

    The target component.

    Declaration
    protected T m_Target { get; }
    Property Value
    Type Description
    T

    Methods

    FindProperty<TValue>(Expression<Func<T, TValue>>)

    Declaration
    protected SerializedProperty FindProperty<TValue>(Expression<Func<T, TValue>> expr)
    Parameters
    Type Name Description
    Expression<System.Func<T, TValue>> expr
    Returns
    Type Description
    SerializedProperty
    Type Parameters
    Name Description
    TValue
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023