ListDrawerSettingsAttribute

Customize the behavior for lists and arrays in the inspector.

namespace Sirenix.OdinInspector
{
[AttributeUsageAttribute((AttributeTargets)384, AllowMultiple = False, Inherited = True)]
public sealed class ListDrawerSettingsAttribute : Attribute
}

Requirements

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector
Version: 1.0.5.0

Properties

Return Type Definition Description
bool DraggableHasValue Not yet documented.
bool DraggableItems Override the default setting specified in the Advanced Odin Preferences window and explicitly tell whether items should be draggable or not.
bool Expanded Override the default setting specified in the Advanced Odin Preferences window and explicitly tell whether or not the list should be expanded or collapsed by default.
bool ExpandedHasValue Not yet documented.
bool HideAddButton If true, the add button will not be rendered in the title toolbar. You can use OnTitleBarGUI to implement your own add button.
bool IsReadOnly Mark a list as read-only. This removes all editing capabilities from the list such as Add, Drag and delete, but without disabling GUI for each element drawn as other wise would be the case if the ReadOnlyAttribute was used.
bool IsReadOnlyHasValue Not yet documented.
string ListElementLabelName Specify the name of a member inside each list element which defines the label being drawn for each list element.
int NumberOfItemsPerPage Override the default setting specified in the Advanced Odin Preferences window and explicitly tells how many items each page should contain.
bool NumberOfItemsPerPageHasValue Not yet documented.
string OnBeginListElementGUI Calls a method before each list element. The member referenced must have a return type of void, and an index paramater of type int which repricents the element index being drawn.
string OnEndListElementGUI Calls a method after each list element. The member referenced must have a return type of void, and an index paramater of type int which repricents the element index being drawn.
string OnTitleBarGUI Use this to inject custom GUI into the title-bar of the list.
bool PagingHasValue Not yet documented.
bool ShowIndexLabels If true, a label is drawn for each element which shows the index of the element.
bool ShowItemCount Override the default setting specified in the Advanced Odin Preferences window and explicitly tell whether or not item count should be shown.
bool ShowItemCountHasValue Not yet documented.
bool ShowPaging Override the default setting specified in the Advanced Odin Preferences window and explicitly tell whether paging should be enabled or not.

Example

This example shows how you can add your own custom add button to a list.

[ListDrawerSettings(ShowAddButton = false, OnTitleBarGUI = "DrawTitleBarGUI")]
public List<MyType> SomeList;

#if UNITY_EDITOR
private void DrawTitleBarGUI()
{
    if (SirenixEditorGUI.ToolbarButton(EditorIcons.Plus))
    {
        this.SomeList.Add(new MyType());
    }
}
#end if