Android text writing on top of itself,Android UI text writing overtop of itself
Hi everyone, I have a strange problem on Android only. Like most games I have a timer counting down in the top right corner of the screen. On Mac/Linux/PC this timer replaces its previous value properly but on Android it writes the new value over top of the previous value. The only place declaring a new text object is via the editor, I am not instantiating text anywhere.
The code below clearly shows I am only updating the text value in one place so why does this happen?
void Update () {
if (!GameStateManager.Instance.Paused && !GameStateManager.Instance.GameOver) {
timeLeft -= Time.deltaTime;
int seconds = ((int) (timeLeft * 100) / 100);
string value = seconds.ToString();
if (timeLeft < 0) {
GameStateManager.Instance.LevelFailed ();
} else if (timeLeft < 10) {
this.text.color = Color.red;
}
if (timeLeft < 5) {
if (lastSecond != seconds) {
this.source.Play ();
}
}
if (timeLeft > 0 && timeLeft < 1) {
float milis = ((int)(timeLeft * 1000)) / 1000f;
value = Mathf.Clamp(milis, 0, 1).ToString();
}
this.text.text = value;
this.lastSecond = seconds;
}
Any help would be appreciated.
Comment