- Home /
Transperent GUI Text?
Hello Everyone i have a GameObject [GUI Text]
i want the Text Show Up With Time From Transparent To The Orange Color then Disappear after few Sec from Orange Color To Transparent .. Gradually
i hope someone can help
Answer by moghes · Feb 21, 2013 at 04:46 PM
Dude its something simple, you will have fun of it!
var yourGuiText:GUIText;
function Update()
{
yourGuiText.material.color.a -= 0.01;
}
Note that you can play with this as you want, remember that Update function is called once per frame, most likely to be 25 frames per second. This means your guiText will need 10 seconds to fade out in this case. aplha = 0 means transparent , alpha = 1 means fully opage..
Answer by robertbu · Feb 21, 2013 at 04:41 PM
You can fade a GUI.Label by changing the alpha value in the GUI.color. You need to save and restore the color value if you are outputting other GUI elements. Example:
public class FadeAGUI : MonoBehaviour {
public Color colorT = Color.red;
void Update () {
colorT.a = Mathf.PingPong(Time.time, 1.0f);
}
void OnGUI() {
Color colorSave = GUI.color;
GUI.color = colorT;
GUI.Label (new Rect(25,25,200,50), "Line one");
GUI.color = colorSave;
GUI.Label (new Rect(25,50,200,50), "Line two");
}
}
Answer by D3m0nE · Feb 21, 2013 at 05:51 PM
Thanks Guyz For Replaying..
@robertbu can i do it on 3D Text?
@moghes thx. i will test it. so color.a = 1 . that mean 255?
and i should put the script inside the 3D Text right?
but there is problem. that 3D Text have the materiel inside Mesh Renderer.
yourGameObject.renderer.material.color.a
the answers that was true or helped you solve the problem, set as true, it will be helpful for other users as well.
Your answer
![](https://koobas.hobune.stream/wayback/20220613093124im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Cooldown indication, transparent rotating texture 1 Answer
Time.deltaTime appears to be running fast 1 Answer
Creating a Circular Progressbar / Timer 6 Answers
Detect Click on Gameobject 0 Answers
How can I make a quest system? 2 Answers