S&box Wiki

Cloud Assets in code

Cloud Code Assets

You might want to use an asset from Asset Party, but you need to reference it from code, rather than from another asset.. so you have no way to suck it into your project.

With the Cloud class you can do this.


This will set the model to the cloud pistol model. It will be available immediately.

pistol.Model = Cloud.Model( "facepunch.w_usp" );

Under The Hood

Behind the scenes the assets are installed on the developer's computer, during code compilation. From there we inject some magic into the code so the package ident is translated to the asset path.. and then everything just works.

The assets will be shipped as part of your package. What this means is that even if the model is changed later on, it won't update until you re-publish your package.

Ident Formats

The ident format can take any form that Package.TryParseIdent can read.

pistol.Model = Cloud.Model( "facepunch.w_usp" ); pistol.Model = Cloud.Model( "facepunch/w_usp" ); pistol.Model = Cloud.Model( "https://asset.party/facepunch/w_usp" );


This relies on the editor being present to work, from a development point of view. If you're playing a local game in non-editor mode then it will not work.