Use slider to modify alpha of a GUI Texture?

Hi guys, I have been working on some user interface stuff for my Mobile Game, now I want to let the user change the transparency of the GUI Controls using a slider like in the hierachy GUI Texture–> color–>sliders—> A, there is a slider to change the transparency of any GUI Texture, any ideas on how to do this but in the game view?

Check this image, I want to replicate the Alpha slider, and let the user control the transparency of the GUI Textures (Controls on the screen)2115-1.jpg


It’s hard to answer if we don’t know what GUI elements you’re using. Are you using GUITextures (images)? Labels? Boxes? Buttons? As for the slider, are you asking how you would make the slider, or how you would make the preexisting slider affect alpha?

Script to make slider affect GUITexture alpha:

var hSliderValue : float = 0.0;
function OnGUI () 
    hSliderValue = GUI.HorizontalSlider(Rect (25, 25, 100, 30), hSliderValue, 0.0, 100.0); //make the slider, and assign the value of it to a variable

var colPreviousGUIColor : Color = GUI.color; //assign variable to current GUI color (just in case you're using a different value other than default)
GUI.color = new Color(colPreviousGUIColor.r, colPreviousGUIColor.g, colPreviousGUIColor.b, hSliderValue/100); //Assign new color to GUI, only affecting the alpha channel
GUI.DrawTexture(new Rect(0,0,Screen.width, Screen.height), yourTextureHere); //draw your texture(s)
GUI.color = colPreviousGUIColor; //Reset alpha and color.

function DrawWithoutAlpha()
    //put any GUI elements you don't want to be affected by alpha (or want a different alpha value) here