Dynamic Asset Loading

Hello dear Community and PlayCanvas Team,

i would like to know if it is possible to download Assets during Runtime that haven´t been set up as Assets in the Project.

For Example:

  1. User Clicks a Button
  2. Application Downloads 3D-Model from www (CORS is considered)
  3. A Script ckecks its name and looks into a JSON File that Contains Information about what kind of Components should be added
  4. Components get added to the Model
  5. Model gets rendered

Is this possible or do all Assets have to be set up in the Editor before, with “Preload” unchecked?


1 Like

Yep. This is totally possible.

Something like this should work:

var asset = new Asset("Remote Model", "model", {
    url: "http://example.com/remote-model.json"

asset.on("load", function (err, model) {

Hey Dave,

thanks for the fast reply. I´ll give that a try :smile:

Hi Dave,

is there some Tool to Convert 3D-Models into the JSON-format that PlayCanvas uses?

You can download models from your scene in the Editor. Select the model and click “Download” in the right attribute panel.

This will give you a zip file containing the model .json file.

1 Like

Hey, I have a question. Will this still work if i don’t have a file url?

In my project, we receive the JSON with a GET (so the info is transmitted from a web page), so we don’t actually have a file.

@Linna_Lim See: How to create/load asset from Json variable (not from file or url)?