Context Menu
ContextMenu component and ContextMenu template. Different menus can use the same template.ContextMenu component.Options
Interactable
boolAllow users interact with the ListView.
Template
ContextMenuTemplateContext menu template.
MenuItems
ObservableList<MenuItem>Menu items.
Is Default
boolIs default menu? Default menu will be opened on context menu key press.
Navigation
boolEnable keyboard and gamepad navigation.
Open On Right Button Click
boolOpen context menu on right mouse button click.
Open On Context Menu Key
boolOpen context menu on context menu key press.
Submenu Delay
floatDelay before open and close sub menu.
Unscaled Time
boolUse unscaled time.
MenuItem Options
Visible
boolIs item visible?
Interactable
boolIs item interactable?
Icon
SpriteIcon.
Checked
boolIs item checked?
Name
stringName.
HotKey
HotKeyHotKey can be enabled with
MenuItem.EnableHotKey()even if item not used in menu (Supported only of InputSystem enabled).Action
UnityEvent<MenuItem>Action on item click.
Items
ObservableList<MenuItem>Nested items.
Events
OnOpen
UnityEvent<ContextMenu>The event raised when context menu opened.
Arguments: opened context menu.
OnClose
UnityEvent<ContextMenu>The event raised when context menu closed.
Arguments: closed context menu.
OnItemSelect
UnityEvent<MenuItem>The event raised when menu item selected.
Arguments: selected menu item.
OnItemDeselect
UnityEvent<ContextMenu>The event raised when menu item deselected.
Arguments: selected menu item.
ContextMenu for non-UI Gameobjects
OpenContextMenu component with the ContextMenu reference to a non-UI game object and the menu will be opened on the right mouse button click.contextMenu.Open(eventData);