menu_bookDocumentation
Cloud Assets: Referencing and Runtime Mounting from sbox.game
s&box provides access to a large library of cloud assets (models, textures, sounds) hosted on sbox.game. Assets are downloaded and cached automatically — no manual file management needed.
Referencing via Properties (Easiest)
Expose a property and use the Cloud Browser to drag assets in:
CSHARP
[Property] public Model MyModel { get; set; } // Accepts local OR cloud modelsReferencing via Code (By Ident)
Use Cloud. functions with dot notation, slash notation, or full URL:
CSHARP
MyModel = Cloud.Model( "facepunch.w_usp" ); // dot notation
MyModel = Cloud.Model( "facepunch/w_usp" ); // slash notation
MyModel = Cloud.Model( "https://sbox.game/facepunch/w_usp" ); // full URLThese assets are downloaded at compile time and shipped with your package. They won't auto-update until you re-publish.
Runtime Mounting (Dynamic Download)
For spawnable props or procedural content, download and mount at runtime:
CSHARP
static async Task<Model> DownloadModel( string packageIdent )
{
var package = await Package.Fetch( packageIdent, false );
if ( package == null || package.Revision == null )
return null;
await package.MountAsync();
var primaryAsset = package.GetMeta( "PrimaryAsset", "" );
return Model.Load( primaryAsset );
}Key Points
- Cloud Browser in the editor lets you drag assets directly into scenes
- Cloud. references are resolved at compile time and bundled with your package
- Package.Fetch + MountAsync is for runtime dynamic loading (GMod-style spawning)
- GetMeta("PrimaryAsset") returns the path to the main asset file (vmdl, vsnd, etc.)
Was this helpful?