Hey,
curiously enough I’m having trouble spawning a template asset into my scene using Javascript.
I made the following function which identifies the template by tag, and supposedly make it appear in the scene. However, when calling the “.addChild()” function everything breaks. All I get are some Playcanvas errors, and I cannot for the life of me figure out what goes wrong, cuz all console logs up until that point looks just fine.
java-script.prototype.addBox = function(typeTag){
let box = this.app.assets.findByTag(typeTag)[0];
console.log('box',box, typeTag);
box.resource.instantiate();
console.log('box 2',box);
this.entity.addChild(box); //Something seems to break here
};
The error messages I receive are:
TypeError: node._updateGraphDepth is not a function
and
TypeError: children[i].syncHierarchy is not a function