Hi.
How do I set new material on meshes that have been instantiated from the asset container?
It does work, but because you have created a standard material and didn’t add a light to the scene, the meshes are rendered black. You should add a light or create a PBR material instead:
Note that you should use BABYLON.Color3.White()
and not BABYLON.Color3.White
.
Also, you should dispose the original material(s) only once: as you call duplicate
twice, you make two loops on the original meshes. And for each loop, you delete the same material several times because all the meshes use the same material. This seems to work, but don’t rely on it, deleting the same object several times is not guaranteed to work.
2 Likes