What counts as an asset
Models
3D geometry files (
.vmdl) for characters, props, and world objects.Materials
Surface definitions (
.vmat) that describe how geometry is shaded.Sounds
Audio files and sound events (
.vsnd) for music, SFX, and voice.Custom assets
Your own
GameResource types with any properties you define.The Asset Browser
The Asset Browser is the in-editor panel for finding and working with assets. Enable Show Base Content in its settings to make the platform’s built-in content (thecitizen addon folder and other core files) visible alongside your project files.
Cloud Browser
The Cloud Browser lets you drag any asset from sbox.game directly into your scene. s&box downloads and caches the files in the background so you do not need to manage them manually.Loading assets in code
Loading by path
Use the staticLoad method on the relevant type to load an asset from a path. Paths are relative to the mounted file system.
Referencing cloud assets by ident
If you know a cloud asset’s ident on sbox.game, use theCloud.* helpers. The asset is downloaded at compile time and shipped with your package.
Mounting cloud assets at runtime
For games where players can spawn arbitrary content (like a sandbox), you can download and mount packages at runtime.Referencing assets via component properties
Expose a typed property on a component and the editor will show a picker that accepts both local and cloud assets.Custom asset types
Define your own asset type by extendingGameResource and decorating it with [AssetType].
File extensions must be all lowercase and eight characters or fewer, otherwise the asset type will fail to register.
ResourceLibrary:
PostLoad to build a static catalogue of all instances:
File system
Standard .NET file access (System.IO.File) is restricted in s&box. Use the provided BaseFileSystem instances instead.
FileSystem.Data — game-specific storage
FileSystem.Data — game-specific storage
Reads and writes to a subdirectory for the currently running game:
C:\steam\steamapps\common\sbox\data\org\game\FileSystem.Mounted — all mounted content
FileSystem.Mounted — all mounted content
An aggregate view of every mounted package: the core game, the current game, and its dependencies. Use this to read asset files shipped with packages.
FileSystem.OrganizationData — cross-game storage
FileSystem.OrganizationData — cross-game storage
Stores data shared across all games in your organization:
C:\steam\steamapps\common\sbox\data\org\Reading and writing JSON
WriteJson and ReadJson only serialize C# properties (not fields). Make sure the data you want to save uses { get; set; }.