s&box
RustCounter-Strike 2s&boxDeadlock
Wiki
Get s&box on Steam
Browse
OverviewGetting StartedCreating GamesEngine & ToolsDocumentationCommunity GamesResources
s&boxDocumentationEditorEditor Shortcuts
SOURCE 2 · C#
Build and play games with s&box.

Facepunch's game engine and creation platform — make games in C#, or jump straight into community games.

Get s&box on Steam

s&box Wiki

  • Overview
  • Getting Started
  • Creating Games
  • Engine & Tools
  • Documentation
  • Community Games
  • Resources

Tools & Community

  • Getting Started
  • Creating Games
  • Engine & Tools
  • Resources

Platforms

  • RustBattle
  • CSBattle
  • Rust Game Wiki
  • CS2 Skins Wiki
  • Deadlock Wiki

About

  • Official Site
  • Developer Wiki
  • GitHub
  • Get on Steam
NOT AFFILIATED WITH FACEPUNCH STUDIOS · © 2026 s&box Wiki (community)
Docs/Editor
Editor

Editor Shortcuts

When creating a Tool or Editor Project, it's common to want to be able to trigger certain actions with a key press or combined keystroke (Like O to enter Object Mode, or SHIFT+B to enter the Block Tool).

Editor Shortcuts do exactly that, while also giving the user the option to rebind each shortcut themselves.

Shortcuts are created by adding the [Shortcut] attribute to a function, giving a name and default bind. The function can reside within any class (including static classes).

[Shortcut("scene.toggle-gizmos", "SHIFT+G")]
static void ToggleGizmos()
{
    // Do stuff...
}

Now whenever you press SHIFT+G in the editor, this static function will be run if the primary Editor window is in focus.

Widget Shortcuts are created just the same, but there's some optional parameters to play with.

[Shortcut("mesh.merge", "M", typeof(SceneViewportWidget), ShortcutType.Widget)]
private void Merge()
{
    // Do stuff...
}

The last 2 arguments are optional.

The first is which type of Widget you need to have in focus to do the shortcut (if none/null, assumes the class the function is defined in is the Widget type)

The second is the ShortcutType, which is either the Widget itself needs to be in focus, a Window containing it needs to be in focus, or the Application as a whole needs to be in focus.

So in this example, Merge() will only be called when pressing M while a SceneViewportWidget is in focus.

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2025-02-04. Read it rendered on the official docs.

More in Editor

Asset Previews
Component Editor Tools
Custom Editors
Editor
Editor Apps
Editor Events
Editor Project
Editor Tools
← All documentation

Community wiki — not affiliated with Facepunch Studios. For the latest and most authoritative information, see the official developer wiki.