How do I use Unity Shortcuts context classes?

I am trying to add new shortcuts using the shortcuts manager. The problem is that I want to bind them to WASD, without any additional qualifiers, which are already taken and thus results in conflicts. I want to add shortcuts for the axis selectors in the top left corner of Scene View. However, I want those shortcuts to only work when I am panning the view with my middle mouse button (then WASD keys would rotate the view).

ShortcutAttribute takes “Type context” as its second parameter, but I can’t find what type to use. The closest I found was UnityEditor.CameraFlyModeContext, which is the context for camera fly mode, but that class is internal and I can’t access it.

How would I go about creating those shortcuts?

3 Likes

Late reply, but this should help :slight_smile:

2 Likes

The issue here is that some build-in editor windows are not exposed. For example, it does not seem possible to find the Hierarchy window as a type, so you cant build a context shortcut for it… :frowning:

To answer OP directly though, SceneView is the name of the EditorWindow you want to provide as context into the shortcut attribute. Doing so will let the shortcut only trigger when the scene view window is active.