- Home /
MenuItem Customizable shortcuts.
hey guys,
i have this menu item but i wanna make a inspector menu where i can edit the shortcuts, but menuItem doesnt take a string what is a way to do it?
public static string shortcut = "&w";
[MenuItem ("Test/do " + shortcut)]
static void Do() {
// do
}
thanks
i don't believe there is a way except rewriting the script which assigns the $$anonymous$$enuItem and recompiling, but that's a lot of complication for little reward.
you'd also have to ensure whatever shortcut was select didn't conflict with any unity specific keys, etc. could be a big ol' can o' worms...
what's the use case? if it's to allow developers to alter to keys then why not just expose the script which assigns the keys and let them fiddle to their hearts' content?
Answer by fafase · Jul 02, 2014 at 01:36 PM
You cannot use variable in attributes. Solution would be to change via reflection at runtime but this is not applicable to your artists.