Graphical error when making UI elements appear/disappear
Hi, So I'm making a leader board and have a submit button which will hide itself when pressed as well as making the top scores appear. I have made the scores disappear by using the following code:
void Awake() { GameObject.Find("Number1").transform.localScale = new Vector2(0,0); GameObject.Find("Number2").transform.localScale = new Vector2(0,0); GameObject.Find("Number3").transform.localScale = new Vector2(0,0); GameObject.Find("Number4").transform.localScale = new Vector2(0,0); GameObject.Find("Number5").transform.localScale = new Vector2(0,0); GameObject.Find("Number6").transform.localScale = new Vector2(0,0); GameObject.Find("Number7").transform.localScale = new Vector2(0,0); GameObject.Find("Number8").transform.localScale = new Vector2(0,0); GameObject.Find("Number9").transform.localScale = new Vector2(0,0); GameObject.Find("Number10").transform.localScale = new Vector2(0,0); }
And the following code to make the text reappear again:
public void main() { GameObject.Find("Number1").transform.localScale = new Vector2(1,130); GameObject.Find("Number2").transform.localScale = new Vector2(1,100); GameObject.Find("Number3").transform.localScale = new Vector2(1,70); GameObject.Find("Number4").transform.localScale = new Vector2(1,40); GameObject.Find("Number5").transform.localScale = new Vector2(1,10); GameObject.Find("Number6").transform.localScale = new Vector2(1,-20); GameObject.Find("Number7").transform.localScale = new Vector2(1,-50); GameObject.Find("Number8").transform.localScale = new Vector2(1,-80); GameObject.Find("Number9").transform.localScale = new Vector2(1,-110); GameObject.Find("Number10").transform.localScale = new Vector2(1,-140); }
where main() is called by a button on the screen. When the button is clicked however, the following happens to my game, and I'm not certain why.
I assume that the black stripes are the text elements. Could someone tell me why the text elements are blurred like this? Thanks.