docs.unity3d.com
    显示 / 隐藏目录

    Class ComponentListEditor<TObject>

    Handles the drawing of a collection of component editors in an inspector.

    Inheritance
    Object
    ComponentListEditor<TObject>
    MARSComponentListEditor
    Namespace: Unity.MARS
    Syntax
    public abstract class ComponentListEditor<TObject>
        where TObject : Object
    Type Parameters
    Name Description
    TObject

    Type of component object the editor is used to inspect.

    Constructors

    ComponentListEditor(Editor)

    Creates a new instance to be used inside an existing Editor.

    Declaration
    protected ComponentListEditor(Editor editor)
    Parameters
    Type Name Description
    Editor editor

    Parent editor of the object that contains the component list.

    Fields

    k_ActionsTab

    Declaration
    protected const int k_ActionsTab = 2
    Field Value
    Type Description
    Int32

    k_AllTabs

    Declaration
    protected const int k_AllTabs = 0
    Field Value
    Type Description
    Int32

    k_ConditionsTab

    Declaration
    protected const int k_ConditionsTab = 1
    Field Value
    Type Description
    Int32

    k_ForcesTab

    Declaration
    protected const int k_ForcesTab = 3
    Field Value
    Type Description
    Int32

    k_SettingsTab

    Declaration
    protected const int k_SettingsTab = 4
    Field Value
    Type Description
    Int32

    m_BaseEditor

    Parent Editor.

    Declaration
    protected Editor m_BaseEditor
    Field Value
    Type Description
    Editor

    m_ComponentList

    The component list collection the editor inspects.

    Declaration
    protected IComponentList<TObject> m_ComponentList
    Field Value
    Type Description
    IComponentList<TObject>

    m_ComponentProperty

    The serialized property of the component list.

    Declaration
    protected SerializedProperty m_ComponentProperty
    Field Value
    Type Description
    SerializedProperty

    m_Editors

    List of all the editors for the component list.

    Declaration
    protected List<ComponentInspector> m_Editors
    Field Value
    Type Description
    List<ComponentInspector>

    m_RemoveList

    Collection of indies representing the items to be removed for the inspector.

    Declaration
    protected List<int> m_RemoveList
    Field Value
    Type Description
    List<Int32>

    m_SerializedObject

    A SerializedObject representing the object or objects being inspected.

    Declaration
    protected SerializedObject m_SerializedObject
    Field Value
    Type Description
    SerializedObject

    Properties

    afterDrawComponentInspector

    Declaration
    public Action<ComponentInspector> afterDrawComponentInspector { get; set; }
    Property Value
    Type Description
    Action<ComponentInspector>

    beforeDrawComponentInspector

    Declaration
    public Action<ComponentInspector> beforeDrawComponentInspector { get; set; }
    Property Value
    Type Description
    Action<ComponentInspector>

    Methods

    AddComponent(Type)

    Adds a component to the settings list from the inspector

    Declaration
    protected abstract void AddComponent(Type type)
    Parameters
    Type Name Description
    Type type

    Type of component to add.

    AddComponentMenuButton()

    Draws the Menu Button for adding a component to the component list.

    Declaration
    protected abstract void AddComponentMenuButton()

    CanDrawSelectedOption(Object, Type, Boolean)

    Declaration
    protected static bool CanDrawSelectedOption(Object targetToDraw, Type typeToDraw = null, bool filteringMenu = false)
    Parameters
    Type Name Description
    Object targetToDraw
    Type typeToDraw
    Boolean filteringMenu
    Returns
    Type Description
    Boolean

    CanPasteComponent(Int32)

    Can the copied component be pasted to the component at the id index.

    Declaration
    protected abstract bool CanPasteComponent(int id)
    Parameters
    Type Name Description
    Int32 id

    Index of the component in the setting list.

    Returns
    Type Description
    Boolean

    True if the contents of the copy can be pasted on this component.

    Clear()

    Disables the component editors and clears them from the list editor

    Declaration
    public virtual void Clear()

    CopyComponent(Int32)

    Copies the components values so they can be pasted on another component of that type.

    Declaration
    protected abstract void CopyComponent(int id)
    Parameters
    Type Name Description
    Int32 id

    Index of the component in the setting list.

    CreateEditor(Object, SerializedProperty, Boolean, Int32)

    Creates a new editor for a component and stores it in the m_Editors list.

    Declaration
    protected virtual void CreateEditor(Object component, SerializedProperty property, bool forceExpanded = false, int index = -1)
    Parameters
    Type Name Description
    Object component

    Component that the new editor is inspecting.

    SerializedProperty property

    Serialized Property representing the Component being inspected.

    Boolean forceExpanded

    Force the base property to be expanded in the inspector.

    Int32 index

    Index in m_Editors where this new editor is stored. Values less than 0 add a new editor to m_Editors.

    CreateNewComponent(Type)

    Creates a new component and returns the new object.

    Declaration
    protected abstract TObject CreateNewComponent(Type type)
    Parameters
    Type Name Description
    Type type

    Type of object to create.

    Returns
    Type Description
    TObject

    Returns the newly create object.

    Init(IComponentList<TObject>, SerializedObject)

    Used to initialize the editor on serializedObject, and set up editors for each component in components.

    Declaration
    public void Init(IComponentList<TObject> components, SerializedObject serializedObject)
    Parameters
    Type Name Description
    IComponentList<TObject> components
    SerializedObject serializedObject

    OnGUI()

    Draws the component editors in an inspector.

    Declaration
    public void OnGUI()

    OnSceneGUI()

    Draws the component editors scene gui.

    Declaration
    public virtual void OnSceneGUI()

    OnUndoRedoPerformed()

    Operations to perform on the editor to keep the values in sync when an undo/redo is performed.

    Declaration
    protected virtual void OnUndoRedoPerformed()

    PasteComponent(Int32)

    Pastes the values of a component over another component.

    Declaration
    protected abstract void PasteComponent(int id)
    Parameters
    Type Name Description
    Int32 id

    Index of the component in the setting list.

    RemoveComponent(Int32)

    Removes a component from the settings list and tells the inspector to clean up the component editor.

    Declaration
    protected abstract void RemoveComponent(int id)
    Parameters
    Type Name Description
    Int32 id

    Index of the component in the setting list.

    RemoveComponents(Boolean)

    Removes the components waiting to be removed in the remove list.

    Declaration
    protected void RemoveComponents(bool withUndo = true)
    Parameters
    Type Name Description
    Boolean withUndo

    ResetComponent(Type, Int32)

    Resets a component with the components default values.

    Declaration
    protected abstract void ResetComponent(Type type, int id)
    Parameters
    Type Name Description
    Type type

    Type of component being reset.

    Int32 id

    Index of the component in the setting list.

    SetComponentTabAccordingToAddedType(Type)

    Declaration
    protected void SetComponentTabAccordingToAddedType(Type type)
    Parameters
    Type Name Description
    Type type
    返回到顶部
    Copyright © 2023 Unity Technologies — 商标和使用条款
    • 法律条款
    • 隐私政策
    • Cookie
    • 不要出售或分享我的个人信息
    • Your Privacy Choices (Cookie Settings)