Reputation: 39
I want to change my shading mode with custom hot key. Is there any kind of way to set your custom hot keys, in unity editor 2022.3f LTS?
I have tried to find out the way. How, we can make our custom hotkeys? But, I can't get the option in unity editor. Can, anybody help me out?
Upvotes: 0
Views: 214
Reputation: 116
you can write an script and add a menu item to do it and in definition you can define its hotkey for example following code will open one of my scenes when I press ctrl+alt+shift+m.
the part that is %#&m
defines its shortcut. see unity document
To create a hotkey, use the following special characters:
%: Represents Ctrl on Windows and Linux. Cmd on macOS.
^: Represents Ctrl on Windows, Linux, and macOS.
#: Represents Shift.
&: Represents Alt.
[MenuItem("Tools/Scenes/Main %#&m")]
public static void OpenMain()
{
if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
EditorSceneManager.OpenScene(Application.dataPath +"/Scenes/Main.unity");
}
Upvotes: 1