[ENGINE ONLY] Asset Loading

Hi,

how can I load a binary file without a config.json using this script?
https://playcanvas.com/editor/code/408537?tabs=4539383

You can use app.assets.loadFromUrl:

app.assets.loadFromUrl(someUrl, "binary", function (err, asset) {
});
1 Like

Thanks, works!!!

@yaustar, just curious, would it also be possible from a scene.json file if such kind a declaration is possible:

"scripts": {
  "loadBinary": {
    "enabled": true,
        "attributes": {
           "file": {
              "filename": "data.bin",
              "size": 48,
              "url": "/assets/data.bin"
            }
        }
    }
 }
 

To be quite honest, you can define your own JSON/settings file and loader since you are using the Engine only.