Skip to content

Dropdown

extends TransitionControl

Inherits from [Control]

The Dropdown class provides a convenient way to implement dropdown menu functionality for user interaction, such as selection lists, filters, etc.

You can obtain the Dropdown control in the following way:

Image alt

typeScript
let go = new GameObject("ui");
let uiComponent = go.AddComponent<UIComponent>(UIComponent);
let canvas = uiComponent.canvas;		
let dropDown = canvas.FindChild<DropDown>("DropDown");

成员变量

Dropdown.value : number
The index value of the currently selected option in the dropdown menu.

成员方法

Dropdown.RemoveOptions ( value : number ) : void
Remove the option at the specified index (index starts from 0) from the dropdown list.
Dropdown.AddOptions ( value : string ) : void
Add an option to the dropdown list.