Struct MenuButton

Special button that brings up a PopupMenu when clicked.

struct MenuButton ;

New items can be created inside this PopupMenu using get_popup().add_item("My Item Name"). You can also create them directly from the editor. To do so, select the MenuButton node, then in the toolbar at the top of the 2D editor, click Items then click Add in the popup. You will be able to give each items new properties.

Properties

NameTypeDescription
items[get, set] Array
switchOnHover[get, set] boolIf true, when the cursor hovers above another MenuButton within the same parent which also has switch_on_hover enabled, it will close the current MenuButton and open the other one.

Methods

NameDescription
_getItems
_setItems
_unhandledKeyInput
getPopup Returns the PopupMenu contained in this button.
isSwitchOnHover
setDisableShortcuts If true, shortcuts are disabled and cannot be used to trigger the button.
setSwitchOnHover