Achievements and Services
s&box provides built-in services for achievements, stats, and leaderboards. Achievements Unlock an Achievement Achievement Types Stat-based - Auto-unlock when s…
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…
Particle Effect system — emitters, manual emission, and custom controllers
Particle Effect System s&box particles are CPU-simulated and fully programmable. A particle system is built from three component types on the same GameObject: (…
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 …
Sandbox: CameraNoiseSystem — screen shake, punch, and recoil with ICameraSetup
CameraNoiseSystem — Screen Shake, Punch, and Recoil Effects is a that implements to apply camera noise effects (shake, punch, recoil) each frame. Effects are in…
Sandbox: Stacker tool — duplicate objects in a line or arc with StackAlignMode
Stacker Tool — Duplicate Objects in a Line or Arc The Stacker tool clones a selected object N times along a configurable axis with optional rotation and gap. It…
Math types — Vector3, Rotation, Angles, Transform, TimeSince, and BBox
Math Types — Vector3, Rotation, Angles, and Transform s&box uses its own math types. Here's a practical reference for the ones you'll use constantly. Vector3 Ro…
Prefab Spawning and Cloning
Prefab Spawning and Cloning Prefabs are reusable GameObject templates that can be instantiated at runtime. Creating Prefabs Create a GameObject in the scene wit…
CameraNoiseSystem example: Camera effects
CameraNoiseSystem Example: Camera Effects CameraNoiseSystem is a GameObjectSystem that applies temporary camera effects (shake, noise, etc.) by implementing ICa…
Slot-based inventory UI with BuildHash optimization
Slot-Based Inventory UI with BuildHash Optimization This example shows a slot-based inventory UI with BuildHash() optimization to prevent unnecessary rebuilds a…
Inventory Hotbar UI Component
Inventory HUD with Hotbar A Razor PanelComponent that displays player inventory slots as a hotbar with mouse wheel and number key support. Implementation Key Fe…
Input Handling Code Examples
Input Handling Code Examples Comprehensive input examples covering buttons, analog sticks, mouse, controller, and VR input. Default Input Actions
Leaderboards API
Implement leaderboards using s&box Services API. Submitting Scores Reading Leaderboards Leaderboard Entry Properties Web API Access Query leaderboards from exte…
Playing Sounds
Playing Sounds in s&box s&box provides both 2D and 3D sound playback through code and components. Quick Sound Playback Sound Handle Store the handle to control …
UIDecal Component - Render Razor UI as a Decal
A Render Component for s&box that allows you to project Razor UI onto surfaces as a Decal. Great for sticking UI onto rounded walls, curved surfaces, or any geo…
Extensible Player Data Save Hooks for World Components
This pattern lets gameplay components plug into a player's save/load flow without putting every feature directly inside one large class. The framework has three…
Sandbox: UndoSystem — per-player undo stack with bounded history (128 steps)
UndoSystem — Per-Player Undo Stack The is a that maintains a per-player undo stack. Each entry holds a set of s that get destroyed when the undo is triggered. U…