i want to create a GUI.Button.
my need is i want to fade in and out the color of Gui.Button with out fading the text inside the gui.button.
i do not want the gui.button to fade.
i want the color inside the gui button should fade in and out like indicator(like traffic light)
i tried with making alpha content a = 0; this if fadding the button itself.i just want the color inside the gui button to fade and fade out
function OnGUI()
{
GUI.backgroundColor.a = Mathf.Lerp(1.0, 0.0,Time.time*0.1);
if(GUI.Button(new Rect(Screen.width *(4.1/6.55), Screen.height*(0.8/6.55),Screen.width*(.4/6.55),Screen.height * (.2/6.55)),""))
{
}
}
i tried this code this fading gui button text along with gui button color.i want text return in the button should not fade along with the color
how to get the effect suppose my button is blue color i want the blue color to fade in and out with out fading the text inside the button. i tried this code GUI.backgroundColor.a = Mathf.Lerp(1.0, 0.0,Time.time*0.1); it is fading the the text along with the gui button color
– anon16754120Not sure what to say. I threw only the first two lines into an OnGUI function and it worked. Then I threw in the bit with the Lerp just to test and... it's keeping the text there while changing the alpha of the button itself. Your button isn't saying anything right now but the color fading should still work..
– TheDemiurgeTry something like
– TheDemiurgeGUI.backgroundColor = Color(0, 0, 1, Mathf.Lerp(1, 0, Time.time*0.1));for the heck of it - see if that makes a difference. Not sure what to say otherwise.