Sizing note:.Dropdown() configures the parent as a Row with CrossAlign(Center) (the layout the dropdown header needs), but does not set Width/Height/Padding — those are your call. Set them on the parent before the .Dropdown() call.
Programmatic Control
// Update options at runtime
m_Dropdown.Options =newList<string> { "New A", "New B", "New C" };
// Change selection
m_Dropdown.SelectedIndex =1;
// Read selection
stringselected= m_Dropdown.SelectedText;
intindex= m_Dropdown.SelectedIndex;
// Toggle popup
m_Dropdown.Toggle();
m_Dropdown.Show();
m_Dropdown.Hide();
Methods
Method
Description
Toggle()
Open or close the popup
Show()
Open the popup
Hide()
Close the popup
Properties
Property
Type
Description
SelectedIndex
int
Get/set selected option index
SelectedText
string
Get the selected option text
IsOpen
bool
Whether popup is visible
Options
List<string>
Get/set options list
PopupMaxHeight
float
Maximum popup height
ItemHeight
float
Per-item height
Direction
DropdownDirection
Popup direction
Searchable
bool
Search field enabled
Events
Event
Signature
Description
OnValueChanged
Action<int>
Fires when selection changes
Callbacks
Callback
Signature
Description
BindItemCallback
Action<GameObject, int, bool>
Custom item rendering (go, index, isSelected)
UnbindItemCallback
Action<GameObject, int>
Cleanup on item recycle
Builder API
Method
Description
.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
.End()
Return to parent LayoutBuilder
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.