e.g
var TestMaterial = pc.createScript(‘testMaterial’);
TestMaterial.attributes.add(‘targetModel’, {type: ‘entity’, title: ‘Target Model’ });
TestMaterial.prototype.initialize = function() {
console.log(this.targetModel.model.meshInstances[0].material.name);
};
console: Untitled
It was right a week ago or earlier…
plz help me , how to get the Asset Material’s name??
here is my test project PlayCanvas | HTML5 Game Engine
There was a change in version 1.6.3 that was released a few days ago.
That said, The material asset should have the name, the fact that the material resource also had the same name may be an unplanned side effect previously.
v 1.6.2 ‘works’: https://launch.playcanvas.com/635795?debug=true&use_local_engine=https://code.playcanvas.com/playcanvas-1.6.2.js
@dave may be able to help here in terms of whether it’s actually a bug?
dave
August 21, 2018, 6:56pm
3
This will be fixed in 1.6.5
dave
August 22, 2018, 12:33am
4
We now assign the asset name to the material name property again.