- Home /
Fade out GUI Texture on android
I want to make a gui texture fade out after 1.5 seconds. For that purpose I wrote this code:
using UnityEngine; using System.Collections;
public class alphaScript : MonoBehaviour { private float flag;
void Start()
{
flag = 0;
}
void OnGUI()
{
if(flag > 1.5)
{
Color textureColor = guiTexture.color;
textureColor.a -= Time.deltaTime / 2;
guiTexture.color = textureColor;
}
}
void Update()
{
flag += Time.deltaTime;
}
}
This script works perfectly on Windows but for some reason this texture don't even come up on android. What did I do wrong? Thanks in advance.
you should probably reset guiTexture.color at start(): guiTexture.color = new Color(1f, 1f, 1f, 1f);
Sorry, I didn't have a chance to check if it works. I'll post here as soon as try it.
Your answer
Follow this Question
Related Questions
[C#] guitexture as button for player move on iOS/android 1 Answer
How to make Canvas appear after GUI texture? Unity 4.7 0 Answers
conversion of script guitexture to cube or other primitive (iphone) 2 Answers
Android tablet 10.1 and guiTexture gui placement with unity 0 Answers
NullReferenceException appears when fading a GUITexture 1 Answer