Just what the title says! I will post two different scripts, because they are both doing different things…? One is calling a NullReference I believe when I run back through the trigger, and the other displays it. What I want to do is disable the trigger after the GUITexture already displayed. (:
#pragma strict
private var somethingElse : GameObject;
var textAppear : GameObject;
function Awake(){
textAppear.GetComponent(BoxCollider).enabled = false;
somethingElse = GameObject.Find("GuiMarker_1");
somethingElse.gameObject.SetActive(false);
}
function OnTriggerEnter (other : Collider) {
textAppear.GetComponent(BoxCollider).enabled = true;
if(other.gameObject.tag == "Player"){
somethingElse.gameObject.SetActive(true);
yield WaitForSeconds(5.0);
somethingElse.gameObject.SetActive(false);
}
}
#pragma strict
private var someText : GameObject;
private var someOther : GameObject;
function Awake(){
someText = GameObject.Find("Hint2");
someText.gameObject.SetActive(false);
someOther = GameObject.Find("WASD");
someOther.gameObject.SetActive(false);
}
function OnTriggerEnter (other : Collider) {
if(other.gameObject.tag == "Player"){
someText.gameObject.SetActive(true);
someOther.gameObject.SetActive(true);
yield WaitForSeconds(10.0); // Wait for X seconds then turn off the gameObject
someText.gameObject.SetActive(false);
someOther.gameObject.SetActive(false);
}
}