Can you alter alpha of a texture (not a GUITexture) from a script?


I’m trying to access the alpha channel of a texture (a .png) from a script in order to fade it using lerp. I understand how to access the alpha channel of GUITextures and materials but is there nothing similar for just textures? Something like texture.color.a?

All my searches have turned up GUITextures or shaders but I just started using Unity so I’m keen to find out if there’s a simpler way before I dive into shaders?


You need a shader on the material that supports both a main color property and supports transparency. Then you set the color in the material (not the texture). More information on setting the color of a game object can be found here:

Edit: I’m away from my desk, but I believe this shader will work for what you want (assuming unlit):