I may have stumbled on a way to solve this issue. It’s not really pretty, but it seems to work. Since the hotkeys are picked up after a whitespace character, you need to place a character before the “&” that won’t/can’t be displayed by Unity. I did this by escaping an undefined ASCII symbol(in hex) right before the “&”. (Any in the range of 7F to 9F)
for example:
[MenuItem("File/This \x8B& That")]
Sneaky. Unless a less hacky answer comes along, I'll accept this as the answer.
I played around with this a little more. Instead of using an "undefined" ASCII character, there is a "non-breaking space" (hex A0) that is displayed as a space, but doesn't get interpreted as the start of a hotkey definition. [MenuItem("File/This\xA0& That")] A little less hacky, but I am also still curious how Unity does this internally.
Sneaky. Unless a less hacky answer comes along, I'll accept this as the answer.
– Robert-CastleI played around with this a little more. Instead of using an "undefined" ASCII character, there is a "non-breaking space" (hex A0) that is displayed as a space, but doesn't get interpreted as the start of a hotkey definition. [MenuItem("File/This\xA0& That")] A little less hacky, but I am also still curious how Unity does this internally.
– roojerryI'm quite struggling with this, could you provide an example with the shortcut letter 'a' and a [MenuItem("Window/Test")]?
– FeastSC2