While it's common knowledge that we can create an Editor menu item in an Editor script with the [MenuItem] attribute, a less well-known ability is being able to set custom hotkeys for menu items. For example, we can make the K
key trigger our menu item method by defining that the [MenuItem] attribute ends with _k, as follows:
[MenuItem("My Menu/Menu Item _k")]
We can also include modifier keys such as Ctrl (cmd), Shift, and Alt using the %, #, and & characters, respectively.
[MenuItem] also has two overloads, which allow us to set two additional parameters: a Boolean that determines whether the menu item requires a validation method and an integer that determines the menu item's priority in the Hierarchy window.
Check out the documentation for [MenuItems] for a complete list of available hotkey modifiers, special keys...