[SOLVED] Changing Material Of A Model's Mesh Instance

Hi all,

I would really like to know how I can change the material of different parts of a 3D model using code.

Try this:

this.entity.model.meshInstances.forEach( function(meshInstance){
   meshInstance.material = myMaterial;
});
1 Like

Can you also let me know how to set my Material to a material in the project?

Have a reference to it as a script attribute or find it in the asset registry.

Thank you for your help.