Code

Advanced Topics

Code Generation

Wrap methods and properties with the [CodeGenerator] attribute. This is the mechanism behind RPCs and networked variables.

Hotloading

How hotload works, how to keep it fast, and the pitfalls to watch out for.

Unit Tests

Adding a unit test project to your game, and testing code that needs the engine.

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2026-08-03. Read it rendered on the official docs.

More in Code

Community wiki — not affiliated with Facepunch Studios. For the latest and most authoritative information, see the official developer wiki.