Skip to content

Dropdown

Popup options selector with optional search filtering. Displays a scrollable list of options with auto-direction detection.

Inspector Setup

  1. Add AutoLayout Dropdown to a GameObject with AutoLayout.
  2. Populate the Options list in the Inspector.
  3. Configure appearance and behavior settings.
FieldTypeDefaultDescription
OptionsList<string>-List of option strings
Selected Indexint-1Currently selected option index
Popup Max Heightfloat400Maximum popup height in pixels
Item Heightfloat48Height of each option item
DirectionDropdownDirectionAutoPopup direction: Auto, Up, or Down
SearchableboolfalseShow search/filter field

Code Usage

Build it in the Inspector (see Inspector Setup above), or from code with the Code API.

Options selector

Options selector

Popup options selector with optional search filtering. Displays a scrollable list of options with auto-direction detection.

Fill in the Options list and set Selected Index. Adjust Popup Max Height and Item Height, choose a Direction (Auto / Up / Down), and toggle Searchable to show the filter field.

Programmatic Control

// Update options at runtime
m_Dropdown.Options = new List<string> { "New A", "New B", "New C" };
// Change selection
m_Dropdown.SelectedIndex = 1;
// Read selection
string selected = m_Dropdown.SelectedText;
int index = m_Dropdown.SelectedIndex;
// Toggle popup
m_Dropdown.Toggle();
m_Dropdown.Show();
m_Dropdown.Hide();

Methods

MethodDescription
Toggle()Open or close the popup
Show()Open the popup
Hide()Close the popup

Properties

PropertyTypeDescription
SelectedIndexintGet/set selected option index
SelectedTextstringGet the selected option text
IsOpenboolWhether popup is visible
OptionsList<string>Get/set options list
PopupMaxHeightfloatMaximum popup height
ItemHeightfloatPer-item height
DirectionDropdownDirectionPopup direction
SearchableboolSearch field enabled

Events

EventSignatureDescription
OnValueChangedAction<int>Fires when selection changes

Callbacks

CallbackSignatureDescription
BindItemCallbackAction<GameObject, int, bool>Custom item rendering (go, index, isSelected)
UnbindItemCallbackAction<GameObject, int>Cleanup on item recycle

Builder API

MethodDescription
.Options(string[]) / .Options(List<string>)Set option strings
.DefaultIndex(int)Set initial selection
.PopupMaxHeight(float)Set max popup height
.ItemHeight(float)Set item height
.Direction(DropdownDirection)Set popup direction
.Searchable()Enable search field
.OnValueChanged(Action<int>)Subscribe to selection changes
.Capture(Action<AutoLayoutDropdown>)Capture component reference

Notes

  • Direction = Auto measures available space above/below and picks the best direction.
  • The popup is created in an overlay layer so it renders above other UI.
  • Search filtering is case-insensitive substring matching.
Docs for AutoLayout PRO v1.0.0 Changelog