Search Unity

Show hotkey with MenuItem but not have it active via MenuItem.

Discussion in 'Scripting' started by cjddmut, Mar 3, 2014.

  1. cjddmut

    cjddmut

    Joined:
    Nov 19, 2012
    Posts:
    179
    I am having a ton of various difficulties with using MenuItem and hotkeys.

    For example, here's the issues I've run into:

    1. Can't seem to use just a letter as a hotkey. I have '_h' as a hotkey but it would only activate if I pressed 'shift+h'.
    2. Can't use '#h' as a hotkey. It prevented me from typing an uppercase 'h' when renaming something. That won't do...
    3. Can't register numpad only hotkeys with MenuItem.

    Well, that's ok cause I can catch keyboard events with a script hooked into SceneView. However, I'd still really like to show the MenuItem with the hotkey that will now work with my event catching script. So my question is if there is a way to display the hotkey with the MenuItem but the hotkey won't register via MenuItem.

    To be clear, I'd still like it to align on the right (so not just have the hotkey as part of the name) and I don't want the MenuItem disabled in case a user would click on it through the menu instead of hotkey.

    Thanks!
    C.J.