menu_bookDocumentation
Application Context Flags: IsDedicatedServer, IsHeadless, IsEditor, IsVR — Runtime Context in s&box
Application Context Flags: IsDedicatedServer, IsHeadless, IsEditor, IsVR
Application is a static class in s&box that exposes runtime context flags. These are set at startup and never change during a session.Key Flags
CSHARP
Application.IsDedicatedServer // true on a dedicated server (no client)
Application.IsHeadless // true when running without a graphics window (terminal/server)
Application.IsEditor // true when running with the tools/editor attached
Application.IsStandalone // true in standalone (published) mode
Application.IsVR // true when VR is active
Application.IsUnitTest // true during unit test runs
Application.IsBenchmark // true when SBOX_MODE=BENCHMARK env var is set
Application.IsDebug // true in DEBUG builds
Application.IsFocused // true if the game window has focus
Application.CheatsEnabled // true if sv_cheats is enabled
Application.LanguageCode // current language code (e.g. "en")
Application.Version // engine version string
Application.VersionDate // UTC DateTime of the buildHow These Affect Component Execution
The engine uses these flags to gate component execution:
- Application.IsDedicatedServer + DontExecuteOnServer interface → component's ShouldExecute returns false
- Application.IsHeadless → OnPreRender() is never called; Input.Down() always returns false
- Scene.IsEditor → components only execute if they implement ExecuteInEditor
Dedicated Server vs Headless
IsDedicatedServer and IsHeadless are related but distinct:- IsHeadless means no graphics window — this is true on dedicated servers but could also be true in other headless contexts.
- IsDedicatedServer specifically means the instance is running as a game server with no local client.
Frame Rate Clamping
On headless instances, the engine caps the frame rate at 60 FPS. When the window is inactive, MaxFrameRateInactive is used if it's lower than MaxFrameRate.
GamePackage and MapPackage
CSHARP
Application.GamePackage // currently loaded game package (null if none)
Application.GameIdent // ident string of the loaded game (e.g. "facepunch.sandbox")
Application.MapPackage // currently loaded map package
Was this helpful?