Multiplayer Authority Patterns
Multiplayer Authority Patterns Community guide for structuring multiplayer code based on official networking documentation and proven patterns. Host-Authoritati…
Prop Component: Procedural Components, Damage System, Gib Spawning, and DamageInfo Patterns
Prop Component: Procedural Physics, Gibs, Damage, and Network Patterns The component is a high-level s&box component that automatically creates , , and componen…
Drag-and-drop system with static instance pattern
Drag-and-Drop System with Static Instance Pattern This example shows a drag-and-drop system using a static instance pattern for global state management and visu…
Ownable Component Pattern for Prop Ownership
Ownable Component - Prop Ownership and Permission System A component that tracks which player spawned an object and enforces ownership-based permissions. Useful…
DynamiteEntity Explosive Entity Pattern
DynamiteEntity - Simple Explosive Entity A simple explosive entity that can be triggered via damage or player input. Demonstrates , , and prefab cloning pattern…
Sandbox: ISpawner interface — custom spawner pattern with ISpawnEvents
ISpawner Interface — Custom Spawner Pattern The interface defines the contract for anything that can be spawned via the spawn menu. Implementations include , , …
NavMeshAgent: MoveTo, WishVelocity Pattern, Off-Mesh Links, Area Constraints, and Path Queries
NavMeshAgent: Navigation, WishVelocity, Links, and Path Control is the s&box component for AI navigation using the scene's navmesh. It uses DotRecast (Detour/Cr…
BuildHash pattern for Razor panel optimization
BuildHash Pattern for Razor Panel Optimization BuildHash is a method you can override in Razor panels to prevent unnecessary rebuilds when the underlying state …
Physgun Grab State with Permission Checks
Physgun Grab State Pattern Implementation pattern for physgun object grabbing with ownership checks and IPhysgunEvent permissions. Key Features Sync'd GrabState…
Component.OnLoad: Async Loading Pattern — LoadingContext, Scene.IsLoading, and Loading Screen Integration
Component.OnLoad: Async Loading Pattern for Components Components can perform async loading work by overriding . This is the correct way to load resources async…
GameManager INetworkListener Pattern
GameManager INetworkListener Pattern Game manager implementing connection lifecycle with player spawning and cleanup. Implemented Interfaces INetworkListener - …
Chat UI Pattern with RPC Broadcasting
Chat UI with RPC Broadcasting A Razor UI component for game chat that handles local input, RPC broadcasting, Steam filtering, and automatic message expiration. …
NetworkHelper — quick multiplayer setup with auto-server and player spawning
NetworkHelper — Quick Multiplayer Setup is a built-in s&box component that handles the boilerplate of starting a server and spawning players. It's the fastest w…
TextRenderer: 3D World Text, TextScope, Localization via # Prefix, Scale vs FontSize, and JsonUpgrader Pattern
TextRenderer: 3D World Text with Localization Support renders text in 3D world space using for font configuration. Basic Usage TextScope The property controls a…
Trigger-Based Background Music Crossfade Framework
This pattern replaces area music with a small local-client music framework. Each zone requests a target , while one controller crossfades the currently playing …
Randomized Clothing for NPC Citizens using Dresser.Randomize() on Prefabs
Overview This demonstrates how to create NPC citizen prefabs with randomized clothing using the built-in component. Each time the prefab spawns or is enabled, i…
Component Event Interfaces for Tool Interactions
Component Event Interfaces (IPhysgunEvent, IToolgunEvent) Event interfaces that allow components to respond to tool interactions. These use s&box's pattern for …
Physics Tracing Code Examples
Physics Tracing Code Examples Raycast and shape trace examples using — the builder pattern for physics queries. TraceResult Properties Builder Pattern Methods
BanSystem Pattern for Player Management
BanSystem - Player Ban Management A GameObjectSystem that manages player bans with persistent storage. Demonstrates , persistence, and RPC commands. Implementat…
Sandbox: BaseConstraintToolMode — two-stage constraint creation with IToolActionEvents
BaseConstraintToolMode — Two-Stage Constraint Creation Pattern is the base for all two-point constraint tools (Weld, Rope, BallSocket, Elastic, Hydraulic, NoCol…