DropDown
Displays the menu at the specified position.
Read time 2 minutesLast updated 7 days ago
Definition
- Type: Method
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
DropDown(Rect)
Displays the menu at the specified position.
public void DropDown(Rect position)
Parameters
The position in the coordinate space of the panel.
Remarks
The parent element that displays the menu:
-
For Editor UI, the parent element is EditorWindow.rootVisualElement.
-
For runtime UI, the parent element is _rootVisualElement.
The parameter determines the width of the menu.
dropdownMenuSizeModeDropDown(Rect, VisualElement, bool)
Displays the menu at the specified position.
public void DropDown(Rect position, VisualElement targetElement, bool anchored = false)
Parameters
The position in the coordinate space of the panel.
The element determines which root to use as the menu's parent.
Remarks
The parent element that displays the menu:
-
For Editor UI, the parent element is EditorWindow.rootVisualElement.
-
For runtime UI, the parent element is _rootVisualElement.
The parameter determines the width of the menu.
dropdownMenuSizeModeDropDown(Rect, VisualElement, bool, bool)
Displays the menu at the specified position.
public void DropDown(Rect position, VisualElement targetElement, bool anchored = false, bool fitContentWidthIfAnchored = false)
Parameters
The position in the coordinate space of the panel.
The element determines which root to use as the menu's parent.
Remarks
The parent element that displays the menu:
-
For Editor UI, the parent element is EditorWindow.rootVisualElement.
-
For runtime UI, the parent element is _rootVisualElement.
The parameter determines the width of the menu.
dropdownMenuSizeModeDropDown(Rect, VisualElement, DropdownMenuSizeMode)
Displays the menu at the specified position.
public override void DropDown(Rect position, VisualElement targetElement, DropdownMenuSizeMode dropdownMenuSizeMode = DropdownMenuSizeMode.Auto)
Parameters
The position in the coordinate space of the panel.
The element determines which root to use as the menu's parent.
Indicates how to format the menu. Refer to DropdownMenuSizeMode for more information. Defaults to Auto.
Remarks
The parent element that displays the menu:
-
For Editor UI, the parent element is EditorWindow.rootVisualElement.
-
For runtime UI, the parent element is _rootVisualElement.
The parameter determines the width of the menu.
dropdownMenuSizeMode