Hello everyone,
I’m attempting to instantiate a template using the following code:
Test.attributes.add('box', { type: 'asset', assetType: 'template' })
// Initialize code called once per entity
Test.prototype.initialize = function () {
let clone = this.box.resources.instantiate();
this.entity.addChild(clone);
clone.setLocalPosition(0, 0, 0);
clone.enabled = true;
};
However, I encounter an error as shown in this image
. Upon checking the console, it appears that the resource is an array. Changing the code to
this.box.resources.instantiate()
resolves the issue. Is there a fix for this?project : PlayCanvas | HTML5 Game Engine
NOTE : same thing doesn’t provide any issue in this game - PlayCanvas 3D HTML5 Game Engine