TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/facepunch/sbox-public/llms.txt
Use this file to discover all available pages before exploring further.
Game static class is the top-level entry point for global game state in s&box. It exposes properties to check the current runtime context, methods for managing the session lifecycle, and convenience accessors for tracing and randomness that are safe to call from any component.
Properties
Runtime context
Returns
true when a game instance is active — that is, the player is not sitting in the main menu. Equivalent to checking whether IGameInstance.Current is non-null.Returns
true when s&box is running with the editor enabled. Use this to gate editor-only logic such as gizmo drawing or inspector helpers.Returns
true when the main menu is visible (i.e. no game instance is active). This value is available server-side but reflects the state of the host.Returns
true when the VR system is active and the player is wearing a headset.Returns
true when running on Steam Deck. Always false server-side.Returns
true while s&box is capturing a video (video console command or F6).Set to
true just before the game closes. Useful for skipping expensive teardown work in OnDisabled / OnDestroy.Identity
The Steam App ID for s&box.
The identifier of the currently loaded game, for example
facepunch.sandbox. Empty when no game is loaded.The local player’s Steam ID.
Scene accessors
Starts a physics-only trace against the current active scene’s physics world. Shorthand for
Game.ActiveScene.PhysicsWorld.Trace.Starts a combined physics + hitbox trace against the current active scene. Shorthand for
Game.ActiveScene.Trace.Randomness
A shared
Random instance that is automatically re-seeded each tick. Use this rather than constructing your own Random to ensure deterministic replays.Persistence
Persistent key/value storage for the current game. Values are serialized to JSON on disk and survive restarts. Use cookies to store per-user preferences or session tokens.
Access to the localization system. Use it to retrieve translated phrases by key.
The runtime reflection system for the current game context. Lets you find, inspect, and instantiate types by name or ID — a sandboxed alternative to .NET reflection.
Methods
Screenshots
Captures a screenshot at the current resolution and saves it to the player’s Steam screenshots library. Also available as the
screenshot console command.Captures a high-resolution screenshot at the specified pixel dimensions using the active scene camera. Available as
screenshot_highres.Session management
Loads a different game by its ident. If called while a networked session is active and
keepClients is true, a reconnect message is sent to clients before the host reloads.Closes the current game. In the editor this exits play mode. In standalone builds it exits the application after disconnecting from any active session.
Disconnects from the current game session without exiting the application.
Randomness
Sets the seed used by
Game.Random. Call this at the start of a round to produce reproducible outcomes across clients.Web
Creates a sandboxed web surface. The surface is limited in what URLs it can reach.
Usage examples
Game.IsEditor and Game.IsRunningOnHandheld are always false on dedicated
servers. Use Networking.IsHost to check host authority instead.Related pages
Networking
Connection management, lobby creation, and
Networking.IsHost.Input
Read player actions, analog values, and keyboard state.