Performance Best Practices
s&box Performance Best Practices Community guide for writing performant s&box code based on engine behavior and developer recommendations. Object Pooling Avoid …
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…
Hotloading Pitfalls: Default Values, Types, Delegates, and Optimization
s&box hotloads code changes live when you save or files. Understanding the pitfalls helps avoid subtle bugs during development. How It Works IL Hotload (Fast): …
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 …
Binary Serialization - s&box Documentation
Official s&box documentation for Binary Serialization - efficient data storage. Binary Serialization saves data in compact binary format. The system handles ver…
VR Development
VR Development Build virtual reality experiences with OpenXR support, tracked devices, and VR-specific components. Setup Enable VR in your project settings. s&b…
Clothing - s&box Assets Documentation
Clothing The clothing system allows players to customize their Citizen character with various wearable items. Create hats, shirts, pants, accessories, and more.…
Razor Panels - s&box Documentation
Official s&box documentation for Razor Panels - the UI layout system. Razor Panels use a familiar HTML-like syntax with C# code-behind for building game interfa…
Hotloading - s&box Documentation
Hotloading Whenever you save a code file in your project (.cs or .razor files), we recompile and attempt to live-reload the changed assembly. This lets you quic…
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…
Hotloading: Live Code Reload Without Editor Restart in s&box
s&box hotloading recompiles and live-reloads code when you save or files, without restarting the editor. How It Works IL Hotload (Fast): If only method bodies c…
Shader Graph - s&box Documentation
Official s&box documentation for the Shader Graph - node-based shader creation. Shader Graph allows creating custom shaders without writing HLSL code. Nodes rep…
Razor Panels: HTML/CSS UI with C# in s&box PanelComponent System
s&box Razor Panels use web-like HTML/CSS syntax with C# for UI creation. Panels are rendered natively (not via HTML renderer) — the syntax is a convenience laye…
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…
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…
Mapping in s&box
Mapping in s&box s&box includes Hammer, the Source 2 level editor, for creating maps. Opening Hammer Main Menu → Tools → Hammer Or click Hammer icon in toolbar …