How to apply a shader to all materials inside a gameobject

Oi Mates!

so, i have an axe i’ve modeled inside 3d Max, i’ve exported it with the textures to Unity.


So, i’ve tried applying shaders using:

gameObject.renderer.material.shader = Shader.Find("DDD");

But the Shader(DDD) would only appear in one of the textures.

A Renderer can have multiple materials. Iterate over it’s materials array and set the shader you need on each material.