Change material works only on a single surface

Hello everyone,

I ve´got a cylinder primitive and want to change the material via script.
Seems the cylinder has only a single meshInstance to me. When I change
the material, the new material apears only on the top surface.
doesent matter if i update the material or not.

HerbiSkin =‘Wings’,‘material’);

this.entity.findByPath(‘Body/…/FLRKnee’).model.meshInstances[0].material = HerbiSkin.resource;

Have no idea what to do, ebery suggestion is very welcome


Hi @Gurki,

Most likely your model has multiple mesh instances. Your code right now changes the material only on the first mesh instance. Here is a fix:

HerbiSkin =‘Wings’,‘material’);

this.entity.findByPath(‘Body/…/FLRKnee’).model.meshInstances.forEach( function(meshInstance){
   meshInstance.material = HerbiSkin.resource;

thanx for the instand help,

I was looking in the wrong direction :slight_smile: , it realy had only one meshInstance and with Your fix I was able to find the problem, couse I knew where to look not. Somewere in my code I’ve doubled my cylinder and changed only one of them. stupid me.

grateful Gurki

1 Like