How to use resource handler for loading a json asset?

Hi everyone, in our project we want to load multiple assets from S3 but I got an error while running the script, it says :
No resource handler found for: function( modelAsset )

Can anyone suggest me a way to add a resource handler in this case? Here is the script I’m using:

var StartActions = pc.createScript('startActions');

// initialize code called once per entity
StartActions.prototype.initialize = function() 
    this.s3Assets = [
         { url/json:, filename:, position:, size-x:, size-y:, size-z:, entityName:, fatherEntity:, scaleX}
            'filename': 'Pantalla.json',
            'url': '',
            'posX': -71,
            'posY': 0,
            'posZ': 0,
            'scaleX': '',
            'scaleY': '',
            'scaleZ': '',
            'scale': 4.68,
            'fatherEntity': 'Decoracion',
            'entityName': 'PantalaTest'

/* Set size of all objects by tag */
StartActions.prototype.setAssetSizes = function()
    var models ="modelSize");
    for (var i = 0; i < models.length; i++)
        models[i].setLocalScale(0.9, 0.9, 0.9);

StartActions.prototype.loadAssets = function()
    var assets = this.s3Assets;
    for (var asset in assets)
        var fatherEnt =;
        var file = { url: asset.url, filename: asset.filename };
        var assetS3 = new pc.Asset('load', function( modelAsset ) 
            var entity = new pc.Entity(asset.entityName);
            entity.model.asset = modelAsset;
            entity.collision.asset = modelAsset;
            entity.collision.enabled = true;
            entity.setPosition(asset.posX, asset.posY, asset.posZ);
            if (!asset.scale !== null || !asset.scale !== undefined) { entity.setLocalScale(asset.scale, asset.scale, asset.scale); } else { entity.setLocalScale(asset.scaleX, asset.scaleY, asset.scaleZ); }

Hi @Axel_Saucedo,

If you are trying to load Playcanvas .json model assets, you don’t have to add a new resource loader.

Try using the loadFromUrl method and specify the type of asset you are loading (model):"", "model", function (err, asset) {
    var model = asset.resource;


Sorry to bother you again Leonidas, it’s due to I had this problem while I was running this script:

This is the test project:

Which files should we be looking at?

Just scripts (startActions JS) due to the asset will be loaded from the url.

You have an error in your code here:

The for loop isn’t getting the object in the array but rather the key/index. Looks like you wanted forEach rather than for … in

1 Like