- Home /
Setting texture for a transparent material in c#
I am coding a sequence of images being played on a billboard (animating an explosion). I am using transparentMaterial with the Transparent/bumped diffuse shader.
Two materials need to be set.
In the documentation for using SetTexture I see:
function SetTexture (propertyName : String, texture : Texture) : void Description Set a named texture. Many shaders use more than one texture. Use SetTexture to change the propertyName texture.
Common texture names used by Unity's builtin shaders:
"_MainTex" is the main diffuse texture. This can also be accessed via mainTexture property.
"_BumpMap" is the normal map.
"_Cube" is the reflection cubemap.
In the inspector I see that the two maps are 'NormalMap' and 'Base (RBG) Trans (A)' as the two textures for the transparent map.
So the documentation doesn't give me an idea of how to use setTexture for setting the two transparent textures. On top of that, passing a string seems like an inefficient way to do this since I have explosions going off all over the place (as any good game would :-) ).
What is an efficient way for me to set the two textures for the transparent material?
Is there something like renderer.material.mainTexture = tex1; for setting the second texture needed for transparency? I am assuming this form sets it directly without a string search as in SetTexture.
Any help appreciated!
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
WebGL VideoTexture not working 0 Answers
Scroll using material.mainTextureOffset makes the texture very distorted 1 Answer
Drawing a display panel with textures. 1 Answer
Light based texture change on material 0 Answers