Hi guys,
i cant seem to find a solution for my following problem. Im struggling for 2-3 hours now and didnt find any solution on the internet that worked.
Im just trying to load a material on a cube model.
class PlayerEntity {
constructor() {
this.entity = new pc.Entity();
// load component
this.entity.addComponent("model", { type: "box" });
this.entity.setName('Player')
const asset = new pc.Asset("proto-orange", "texture", {
url: "./assets/textures/proto_orange.png"
});
app.assets.add(asset)
this.entity.model.meshInstances[0].material = asset.resource;
}
}
And im getting the following error:
playcanvas-engine.js:17526 Uncaught TypeError: Cannot read property 'blendType' of undefined
at Layer.addMeshInstances (playcanvas-engine.js:17526)
at ModelComponent.addModelToLayers (playcanvas-engine.js:24650)
at ModelComponent.onEnable (playcanvas-engine.js:24773)
at Entity._onHierarchyStateChanged (playcanvas-engine.js:38480)
at Entity._notifyHierarchyStateChanged (playcanvas-engine.js:38452)
at Entity._onInsertChild (playcanvas-engine.js:11694)
at Entity.addChild (playcanvas-engine.js:11671)
at main.js:26
i hope someone got a solution for this