how to know single mesh renderer attached no of materials ??

hello

I have object with mesh that contains two materials.
I cant access two materials attached on single mesh renderer.

I there any way to access these materials ??

thank you

With Renderer.material you can access only the first material of the renderer. To access all materials you have to use Renderer.materials which returns a Material array.

i used like this.

Material mats = renderer.materials;
Debug.Log(mats[0].name);
Debug.Log( mats[1].name);
Debug.Log( mats[2].name);

its working fine… thank you