- Home /
Access materials Array for a Plane at runtime (C#)
I noticed that you can set up multiple materials on a Plane in the inspector. I need the material to change based on a global static int variable from another script. Here is what I am referring to:
My question is, how do I access these materials from the code (in C#) so I change them based on the score? I am struggling with these because a Plane does not have a renderer, nor can I use it as a global variable because it seems to be just a Struct with a Vector3 and a Float from the documentation.
Appreciate any help.
Answer by DaveA · Mar 14, 2013 at 08:26 PM
http://docs.unity3d.com/Documentation/ScriptReference/Renderer-materials.html
Example here: http://docs.unity3d.com/Documentation/ScriptReference/Renderer-material.html
Your answer
Follow this Question
Related Questions
c# 2D array error: need Help! 1 Answer
Can't disable script 1 Answer
Dynamic batching 6 Answers
Set up Maya/FBX file so that it is automatically assigned an existing material on import? 2 Answers
Unity Materials and UV coordinate help 3 Answers