menu_bookDocumentation
Cloud Assets: Using sbox.game Models, Textures, and Sounds in Your Project
s&box provides access to a large selection of cloud assets (textures, models, sounds) from sbox.game without manual downloading or mounting.
Cloud Browser
Drag assets directly from the Cloud Browser into your scene. Assets download behind the scenes and are cached automatically.
Referencing via Properties
Expose variables as [Property] on Components — cloud assets work identically to local assets:
CSHARP
public Model MyModel { get; set; } // Can reference Local OR Cloud modelsReferencing via Code (Ident)
Use Cloud. functions with dot notation, slash notation, or direct 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" ); // Direct URLThese assets download during compilation and ship with your package. They won't auto-update until you re-publish.
Runtime Mounting
For dynamic asset loading (spawn menus, procedural generation):
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 );
}
Was this helpful?