November 2019
Intermediate to advanced
404 pages
12h 9m
English
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 ...
Read now
Unlock full access