Revision Difference
Downloading_Assets_For_Your_Server#563099
<cat>Code.Misc</cat>⤶
<title>Mounting assets at runtime</title>⤶
⤶
⤶
#Mounting assets at runtime⤶
⤶
Sometimes you might need to download and mount certain resources from [asset.party](https://asset.party) at runtime. Maybe you're making a GMod style game with spawnable props, maybe you're procedurally generating something.⤶
⤶
## Example method⤶
⤶
The Sandbox gamemode has a great method that allows you to download and mount models from [asset.party](https://asset.party).⤶
⤶
```⤶
static async Task DownloadAsset( string packageName)⤶
{⤶
var package = await Package.Fetch( packageName, false );⤶
if ( package == null || package.PackageType != Package.Type.Model || package.Revision == null )⤶
{⤶
// spawn error particles⤶
return;⤶
}⤶
⤶
var model = package.GetMeta( "PrimaryAsset", "models/dev/error.vmdl" );⤶
// downloads if not downloaded, mounts if not mounted⤶
await package.MountAsync();⤶
⤶
Precache.Add( model );⤶
}⤶
```⤶
<cat></cat>⤶
Moved page to [sbox.game](https://sbox.game/dev/doc/assetsresources/cloud-assets/)