- Home /
Question by
ultrasilence · Feb 25, 2013 at 10:49 PM ·
colorguitexturefade
Making GUITexture start transparent then fade in.
How would one go about doing this? I've looked over several questions posted on here and just cannot find a suitable answer. Some have said guiTexture.color.a, but compiler complains that you cannot do anything with that.
I found some code that does indeed fade in and out a guitexture, but even with me trying to manipulate that I cannot figure out how to start it as completely transparent then fade it in.
Any help via c# code would be extremely helpful.
Comment
Best Answer
Answer by MikeNewall · Feb 25, 2013 at 11:34 PM
My last answer was full of fail -_-
This works:
void OnGUI()
{
alpha = Mathf.Lerp(alpha, 1, 0.1f * Time.deltaTime);
guiTexture.color = new Color(1,1,1, alpha);
}