Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


DropdownField

Construct an empty DropdownField.
Read time 2 minutesLast updated 11 days ago

Definition

Construct an empty DropdownField.
public DropdownField()
Construct a DropdownField with a Label in front.
public DropdownField(string label)

Parameters

label

The label to display in front of the field.
Construct a DropdownField.
public DropdownField(List<string> choices, string defaultValue, Func<string, string> formatSelectedValueCallback = null, Func<string, string> formatListItemCallback = null)

Parameters

The list of choices to display in the dropdown.

defaultValue

The default value selected from the dropdown.

formatSelectedValueCallback

Callback to format the selected value.

formatListItemCallback

Callback to format the list items displayed in the dropdown.
Construct a DropdownField.
public DropdownField(string label, List<string> choices, string defaultValue, Func<string, string> formatSelectedValueCallback = null, Func<string, string> formatListItemCallback = null)

Parameters

label

The label to display in front of the field.

The list of choices to display in the dropdown.

defaultValue

The default value selected from the dropdown.

formatSelectedValueCallback

Callback to format the selected value.

formatListItemCallback

Callback to format the list items displayed in the dropdown.
Construct a DropdownField.
public DropdownField(List<string> choices, int defaultIndex, Func<string, string> formatSelectedValueCallback = null, Func<string, string> formatListItemCallback = null)

Parameters

The list of choices to display in the dropdown.

defaultIndex

The index of the choice selected by default.

formatSelectedValueCallback

Callback to format the selected value.

formatListItemCallback

Callback to format the list items displayed in the dropdown.
Construct a DropdownField.
public DropdownField(string label, List<string> choices, int defaultIndex, Func<string, string> formatSelectedValueCallback = null, Func<string, string> formatListItemCallback = null)

Parameters

label

The label to display in front of the field.

The list of choices to display in the dropdown.

defaultIndex

The index of the choice selected by default.

formatSelectedValueCallback

Callback to format the selected value.

formatListItemCallback

Callback to format the list items displayed in the dropdown.