How to fix my GUI Text?
Ok so when I was trying to make my game, I had two texts. One text starts immediately after you play the game and one activates when you collider with a box that has the mesh renderer deactivated and the box collider with is trigger activated. The first text works perfectly fine. The second text is almost the same as the first. First Text Script:
var QuestUpdate : GameObject;
var PlayerText : GameObject;
var TextDisplay : GameObject;
function Start() {
transform.position = Vector3(0, -1000, 0);
TextDisplay.SetActive (true);
PlayerText.GetComponent.<Text>().text = "Where am I?";
yield WaitForSeconds (3);
PlayerText.GetComponent.<Text>().text = "Let's follow the path over there and see where it takes us.";
yield WaitForSeconds (2);
PlayerText.GetComponent.<Text>().text = "";
TextDisplay.SetActive (false);
this.gameObject.SetActive (false);
QuestUpdate.GetComponent.<Text>().text = "Active Quest: Follow The Path";
}
Second:
var QuestUpdate : GameObject;
var PlayerText : GameObject;
var TextDisplay : GameObject;
function OnTriggerEnter (col : Collider) {
transform.position = Vector3(0, -1000, 0);
TextDisplay.SetActive (true);
PlayerText.GetComponent.<Text>().text = "Look's like there's a village over there.";
yield WaitForSeconds (3);
PlayerText.GetComponent.<Text>().text = "Let's go there and see what we can find.";
yield WaitForSeconds (2);
PlayerText.GetComponent.<Text>().text = "";
TextDisplay.SetActive (false);
this.gameObject.SetActive (false);
QuestStatus.GetComponent.<Text>().text = "Active Quest: Reach The Village";
}
As you can see the second script is almost completely the same as the first. Both scripts also use the same MessageBox and the same TextDisplay so the second text SHOULD work just like the first but it doesn't. What it instead does is it places the text for the second in the middle of the screen instead of the TextDisplay. Please help me because I honestly am stumped at why this is happening.