The s&box editor supports keyboard shortcuts for common actions. You can also define your own shortcuts in an editor project.
Defining custom shortcuts
Static shortcuts
A static shortcut runs regardless of which widget is focused, as long as the main editor window is in focus. Add the [Shortcut] attribute to any static function:
[Shortcut("scene.toggle-gizmos", "SHIFT+G")]
static void ToggleGizmos()
{
// Runs when SHIFT+G is pressed in the editor
}
A widget shortcut only runs when a specific widget (or a window containing it) is in focus:
[Shortcut("mesh.merge", "M", typeof(SceneViewportWidget), ShortcutType.Widget)]
private void Merge()
{
// Runs when M is pressed while a SceneViewportWidget is focused
}
The [Shortcut] attribute takes:
- A unique shortcut name (used for rebinding)
- The default key binding
- (Optional) The widget type that must be in focus
- (Optional)
ShortcutType — Widget, Window, or Application
Users can rebind all shortcuts in the editor preferences.
Built-in shortcuts reference
Scene and play mode
| Action | Shortcut |
|---|
| Play / Stop | F5 |
| Save scene | Ctrl+S |
| Save all | Ctrl+Shift+S |
| Open scene | Ctrl+O |
| New scene | Ctrl+N |
| Action | Shortcut |
|---|
| Select tool | Q |
| Translate (move) | W |
| Rotate | E |
| Scale | R |
| Toggle local/world space | X |
Scene viewport navigation
| Action | Shortcut |
|---|
| Focus selected object | F |
| Frame all objects | A |
| Orbit camera | Alt + Left Mouse |
| Pan camera | Alt + Middle Mouse or Middle Mouse drag |
| Zoom | Scroll Wheel or Alt + Right Mouse |
| Fly camera (hold) | Right Mouse + W A S D |
Selection and editing
| Action | Shortcut |
|---|
| Select all | Ctrl+A |
| Deselect all | Escape |
| Duplicate | Ctrl+D |
| Delete | Delete |
| Undo | Ctrl+Z |
| Redo | Ctrl+Y or Ctrl+Shift+Z |
| Cut | Ctrl+X |
| Copy | Ctrl+C |
| Paste | Ctrl+V |
Hierarchy and assets
| Action | Shortcut |
|---|
| Rename selected | F2 |
| Expand all in tree | Ctrl + Right Arrow |
| Collapse all in tree | Ctrl + Left Arrow |
| Search in Asset Browser | Ctrl+F |
You can rebind any shortcut in Edit → Preferences → Keybinds. Shortcuts defined with [Shortcut] in your editor project also appear there and can be rebound by users.