- Home /
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
Answer by Bunny83 · Sep 12, 2015 at 09:02 AM
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.
Answer by ajaybhojani · Sep 15, 2015 at 12:31 PM
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
Your answer
Follow this Question
Related Questions
Combining Mesh's For Mesh Deformation 1 Answer
Objects Appear in the wrong place when built 1 Answer
Is it bad to have many mesh renders? 1 Answer
Lost Lightmap in Mesh Renderer 0 Answers
how to set the uv of the texture(or mesh renderer) 2 Answers