fade a button

Is there a good way to make a button fade out when clicked then when transparent destroy it? I have tried the fade script that seems to be a fav here, but it just gives me the does not recognize fade error even when I attach it to objects

do you speak of a GUI button or a GUI texture button?

1 Answer

1

LeanTween has alpha fading support for Unity’s GUI Elements. Here is an example of fading a button on click:

var buttonRect3:LTRect = new LTRect(0.0, 0.0, 200, 100 );

function OnGUI(){
	if(GUI.Button(buttonRect3.rect, "Alpha")){
		LeanTween.alpha( buttonRect3, 0.0, 1.0, ["ease",LeanTweenType.easeOutQuad] );
	}
}