- Home /
Using one material for multiple textures
I am creating a game where I would like to apply a color scheme to each player's units. The way I am currently doing this is to have a single material that is applied to all units. The problem I'm running into is changing the textures when it is time to draw a different unit. Is there an easy way to do this besides making a separate material for each unit?
Answer by Owen-Reynolds · Feb 19, 2013 at 04:39 PM
Look up Material in the scripting reference (top search on "Unity Material".) You can set the mainTexture property (it has an example.)
But, there's good chance you may want to have a material for each color. Suppose one of the colors is shiny gold. You might want a specular shader for that, with certain settings. A tree-bark "color" may want a bump-map shader, with the extra bump-map texture. Might be better to Edit->Duplicate materials, even though most are only a texture change. Then swap materials instead of just textures.
Your answer
Follow this Question
Related Questions
How do you properly let unity resize texture tiling? 0 Answers
3d model editing and multiple textures per material 0 Answers
Setting a material texture and saving it 1 Answer
Get Texture 2D after all shader passes are applied 0 Answers
Tiling textures in material without changing the material. 0 Answers