Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


DropDown

Displays the menu at the specified position.
Read time 2 minutesLast updated 7 days ago

Definition

Displays the menu at the specified position.
Warning
Deprecated. This version of Dropdown is deprecated. To ensure the dropdown is positioned correctly, please provide a reference to the targetElement.
public void DropDown(Rect position)

Parameters

position

The position in the coordinate space of the panel.

Remarks

The parent element that displays the menu:
The
dropdownMenuSizeMode
parameter determines the width of the menu.
Displays the menu at the specified position.
Warning
Deprecated. This version of Dropdown is deprecated. Please use DropDown(Rect position, VisualElement targetElement, DropdownMenuSizeMode dropdownMenuSizeMode).
public void DropDown(Rect position, VisualElement targetElement, bool anchored = false)

Parameters

position

The position in the coordinate space of the panel.

targetElement

The element determines which root to use as the menu's parent.

anchored

Remarks

The parent element that displays the menu:
The
dropdownMenuSizeMode
parameter determines the width of the menu.
Displays the menu at the specified position.
Warning
Deprecated. This version of Dropdown is deprecated. Please use DropDown(Rect position, VisualElement targetElement, DropdownMenuSizeMode dropdownMenuSizeMode).
public void DropDown(Rect position, VisualElement targetElement, bool anchored = false, bool fitContentWidthIfAnchored = false)

Parameters

position

The position in the coordinate space of the panel.

targetElement

The element determines which root to use as the menu's parent.

anchored


fitContentWidthIfAnchored

Remarks

The parent element that displays the menu:
The
dropdownMenuSizeMode
parameter determines the width of the menu.
Displays the menu at the specified position.
public override void DropDown(Rect position, VisualElement targetElement, DropdownMenuSizeMode dropdownMenuSizeMode = DropdownMenuSizeMode.Auto)

Parameters

position

The position in the coordinate space of the panel.

targetElement

The element determines which root to use as the menu's parent.

dropdownMenuSizeMode

Indicates how to format the menu. Refer to DropdownMenuSizeMode for more information. Defaults to Auto.

Remarks

The parent element that displays the menu:
The
dropdownMenuSizeMode
parameter determines the width of the menu.