Can't reference imported material to change it's colour

I’m trying to reference the imported red material from the glTF (Material.001), so I can manipulate this once imported. But what I’ve tried just creates another material with the same name, as seen in the inspector.
I also tried scene.getMaterialById which I commented out as this didn’t seem to work either. No duplicate of the material with this but I wasn’t able to manipulate the material either.

Thank you for any help

Hey @ryannewelluk
Instead of Using the getMaterialById(), use the getMaterialByName() method :smiley:
Also keep in mind that it uses only one argument (“name”)!

var myMaterial = scene.getMaterialByName("Material.001")

An other way how you could handle it: (but only in the callback of the ImportMesh() ) ! :face_with_monocle:

var myMaterial = meshes[1].material;

1 Like

That’s excellent, thanks very much for the tips @wulf11