Components - s&box Documentation
Components A Component is added to a GameObject to provide functionality. This functionality can vary wildly. You could add a component that renders a model at …
Citizen Characters - s&box Assets Documentation
Citizen Characters The Citizen is s&box's default human character model. It provides a standardized base for player characters, NPCs, and customization through …
Libraries
Libraries Create reusable, shareable code and asset libraries. Structure Libraries live in folder: How It Works Game code references all installed libraries Lib…
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): …
Common Pitfalls and How to Avoid Them
s&box Common Pitfalls and How to Avoid Them Community-compiled list of frequently encountered issues and their solutions, based on Discord support channels and …
GameObject.Clone: Two-Pass Cloning, CloneConfig, NotCloned Flag, and Reference Rewiring
GameObject.Clone: Spawning Prefabs and Cloning GameObjects with CloneConfig is the primary way to instantiate prefabs and duplicate GameObjects in s&box. It per…
GameResource: Custom Asset Types, PostLoad, PostReload, ResourceLibrary.Get, and Resource Networking
GameResource: Custom Asset Types, PostLoad, and Resource Networking is the base class for all JSON-based assets in s&box (prefabs, scene files, custom assets). …
s&box AmmoResource: Shared ammo type GameResource
AmmoResource GameResource API Reference AmmoResource is a GameResource that defines a type of ammo that can be shared across weapons. Weapons that reference the…
s&box ResourceLibrary: Loading and Accessing Game Resources
s&box ResourceLibrary: Loading and Accessing Game Resources (and ) provides access to all loaded resources. Loading Resources ```csharp // Synchronous get (retu…
IsValid: Safe Null and Destroyed Object Checking in s&box
In s&box, destroying a or doesn't erase the C# reference — the variable still holds a non-null but dead object. Use instead of null checks. Common Patterns Guar…
s&box Cheat Sheet
s&box Cheat Sheet Quick reference for common s&box operations. Debugging Transforms GameObjects Components Input Networking
IsValid Pattern: Safe Null and Destroyed Object Checks
Destroying a or doesn't erase the C# reference — the variable still holds a non-null but dead object. A plain check will pass on destroyed objects, leading to e…
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…
NetworkMode, NetworkFlags, OwnerTransfer, NetworkOrphaned — Complete Networking Enum Reference
NetworkMode, NetworkFlags, OwnerTransfer, and NetworkOrphaned — Complete Reference NetworkMode Controls how a is networked. Set via . Once a is a , only the hos…
Component.GetComponent, GetComponentInChildren, GetComponentInParent — FindMode and RequireComponent
Component.GetComponent, GetComponentInChildren, GetComponentInParent — FindMode Reference Components provide convenient lookup methods for finding other compone…
s&box Sandbox Security Model: Assembly Whitelist, Blocked APIs, Reflection Restrictions, and Safe Assembly Caching
s&box Sandbox Security Model: Assembly Access Control and Whitelisted APIs s&box uses a whitelist-based security model to prevent game code from accessing dange…
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…
Libraries - s&box Code Documentation
Libraries Libraries are reusable code packages you can share between projects or distribute to others. They provide a way to modularize your code and avoid dupl…
Custom Assets - s&box Documentation
Official s&box documentation for Custom Assets - user-defined resource types. Custom Assets allow defining new asset types for your game. GameResource is the ba…
s&box Rigidbody Component: Physics Body Reference
s&box Rigidbody Component: Physics Body Reference adds physics simulation to a . It requires at least one component on the same object. Key Properties Force and…