In my project there is a Main Camera and a Text UI on a Canvas and the below script.
Why is my text get superpose on the previous text after pressing the spacebar and how can I avoid this behaviour?
using UnityEngine;
using UnityEngine.UI;
public class PlayBoard : MonoBehaviour
{
static Text message;
void Awake()
{
message = GameObject.Find("messageBox").GetComponent<Text>();
}
void Start()
{
message.text = "To begin press space bar";
}
void Update()
{
if (Input.GetKeyDown("space"))
{
message.text = "New Message should appear in clear";
}
}
}
