docs.unity3d.com
    Show / Hide Table of Contents

    Class BaseEditor<T>

    A convenience base class for making inspector editors.

    Inheritance
    Object
    Object
    ScriptableObject
    Editor
    BaseEditor<T>
    CinemachineBrainEditor
    CinemachineVirtualCameraBaseEditor<T>
    Inherited Members
    Editor.CreateEditorWithContext(Object[], Object, Type)
    Editor.CreateEditorWithContext(Object[], Object)
    Editor.CreateCachedEditorWithContext(Object, Object, Type, Editor)
    Editor.CreateCachedEditorWithContext(Object[], Object, Type, Editor)
    Editor.CreateCachedEditor(Object, Type, Editor)
    Editor.CreateCachedEditor(Object[], Type, Editor)
    Editor.CreateEditor(Object)
    Editor.CreateEditor(Object, Type)
    Editor.CreateEditor(Object[])
    Editor.CreateEditor(Object[], Type)
    Editor.DrawPropertiesExcluding(SerializedObject, String[])
    Editor.DrawDefaultInspector()
    Editor.Repaint()
    Editor.CreateInspectorGUI()
    Editor.RequiresConstantRepaint()
    Editor.DrawHeader()
    Editor.OnHeaderGUI()
    Editor.ShouldHideOpenButton()
    Editor.DrawFoldoutInspector(Object, Editor)
    Editor.HasPreviewGUI()
    Editor.GetPreviewTitle()
    Editor.RenderStaticPreview(String, Object[], Int32, Int32)
    Editor.OnPreviewGUI(Rect, GUIStyle)
    Editor.OnInteractivePreviewGUI(Rect, GUIStyle)
    Editor.OnPreviewSettings()
    Editor.GetInfoString()
    Editor.DrawPreview(Rect)
    Editor.ReloadPreviewInstances()
    Editor.UseDefaultMargins()
    Editor.Initialize(Object[])
    UnityEditor.Editor.MoveNextTarget()
    Editor.ResetTarget()
    Editor.target
    Editor.targets
    Editor.serializedObject
    Editor.finishedDefaultHeaderGUI
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(String)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: Cinemachine.Editor
    Syntax
    public class BaseEditor<T> : Editor, IPreviewable, IToolModeOwner where T : class
    Type Parameters
    Name Description
    T

    The class we're editing

    Properties

    Target

    The target object, cast as the same class as the object being edited

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

    Methods

    BeginInspector()

    Clients should call this at the start of OnInspectorGUI.
    Updates the serialized object and Sets up for excluded properties.

    Declaration
    protected virtual void BeginInspector()

    DrawPropertyInInspector(SerializedProperty)

    Draw a property in the inspector, if it is not excluded.
    Property is marked as drawn, so will not be drawn again by DrawRemainingPropertiesInInspector()

    Declaration
    protected virtual void DrawPropertyInInspector(SerializedProperty p)
    Parameters
    Type Name Description
    SerializedProperty p

    The property to draw

    DrawRemainingPropertiesInInspector()

    Draw all remaining unexcluded undrawn properties in the inspector.

    Declaration
    protected void DrawRemainingPropertiesInInspector()

    ExcludeProperty(String)

    Exclude a property from automatic inclusion in the inspector when DrawRemainingPropertiesInInspector() is called

    Declaration
    protected void ExcludeProperty(string propertyName)
    Parameters
    Type Name Description
    String propertyName

    The property to exclude

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

    Magic code to get the string name of a field. Will not build if the field name changes.

    Declaration
    protected string FieldPath<TValue>(Expression<Func<T, TValue>> expr)
    Parameters
    Type Name Description
    Expression<Func<T, TValue>> expr

    Call format is FieldPath(x => x.myField)

    Returns
    Type Description
    String

    The string name of the field

    Type Parameters
    Name Description
    TValue

    Magic experssion code

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

    Return the Serialized property for a field, and exclude it from being automatically displayed in the inspector. Call this when you need to provide a custom UX for a field.

    Declaration
    protected SerializedProperty FindAndExcludeProperty<TValue>(Expression<Func<T, TValue>> expr)
    Parameters
    Type Name Description
    Expression<Func<T, TValue>> expr

    Call format is FindAndExcludeProperty(x => x.myField)

    Returns
    Type Description
    SerializedProperty

    The serialized property for the field

    Type Parameters
    Name Description
    TValue

    Magic experssion code

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

    Return the Serialized property for a field.

    Declaration
    protected SerializedProperty FindProperty<TValue>(Expression<Func<T, TValue>> expr)
    Parameters
    Type Name Description
    Expression<Func<T, TValue>> expr

    Call format is FindProperty(x => x.myField)

    Returns
    Type Description
    SerializedProperty

    The serialized property for the field

    Type Parameters
    Name Description
    TValue

    Magic experssion code

    GetExcludedPropertiesInInspector()

    Obsolete, do not use. Use the overload, which is more performant

    Declaration
    protected virtual List<string> GetExcludedPropertiesInInspector()
    Returns
    Type Description
    List<String>

    List of property names to exclude

    GetExcludedPropertiesInInspector(List<String>)

    Get the property names to exclude in the inspector.

    Declaration
    protected virtual void GetExcludedPropertiesInInspector(List<string> excluded)
    Parameters
    Type Name Description
    List<String> excluded

    Add the names to this list

    IsPropertyExcluded(String)

    Check whenther a property is in the excluded list

    Declaration
    protected bool IsPropertyExcluded(string propertyName)
    Parameters
    Type Name Description
    String propertyName

    The property to check

    Returns
    Type Description
    Boolean

    True if property is excluded from automatic inclusion in the inspector when DrawRemainingPropertiesInInspector() is called

    OnInspectorGUI()

    Draw the inspector

    Declaration
    public override void OnInspectorGUI()
    Overrides
    Editor.OnInspectorGUI()
    Back to top
    Terms of use
    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