S&box Wiki

Making a Custom Pause Screen

Overriding s&box's Default Pause Menu

By default, s&box will show this pause menu when a player presses the ESC key in-game:

sbox_5iXD7x59uR.png

This gives players the options expected of a pause menu so that the game's developer doesn't have to code them.

But if you're reading this, then maybe these options weren't enough.

So, here's how to override the default pause menu:

//This assumes your pause screen is as simple as turning a GameObject with a screen panel on and off [Property] public GameObject PausePanel {get; set;} protected override void OnUpdate() { if ( Input.EscapePressed ) { Input.EscapePressed = false; //The ESC Key is now yours to control, so you could do the following PausePanel.Enabled != PausePanel.Enabled; } }

Using in-built Overlays for your menu

If you wanted to use the default pause menu's Keybind Overlay, you can do so with

<div class="tab" @onclick="@(() => Game.Overlay.ShowBinds() )">Controls</div>

Same with the "About" screen

<div class="tab" @onclick="@(() => Game.Overlay.ShowPackageModal( [Indent Here ex: facepunch.test] ))">About</div>