hey i was just wondering if theres a way to deactivate a trigger on trigger exit? I have an objective trigger which shows an introductory to the game but if i step back on it plays all over again. heres the script.
var dooropenandclose : AnimationClip; //this is your animation clip.
var Celldooropensound : AudioClip;
var door : GameObject; //this is your game object that you want to move on trigger.
private var closed = true; // door initially closed
var labelText : String = "";
var ClickSound : AudioClip;
function OnTriggerEnter(){
audio.PlayOneShot(ClickSound);
labelText = "This is your cell. You can come back here anytime to save when not on a mission. ";
yield WaitForSeconds (10);
audio.PlayOneShot(ClickSound);
labelText = "To save, go to your bed and press 'E'.";
yield WaitForSeconds (10);
labelText = "";
if (closed){ // only do it if door closed
closed = false; // door now is open
animation.Play ("dooropenandclose");
audio.PlayOneShot(Celldooropensound);
}
}
function OnTriggerExit (other : Collider){
if (other.gameObject.tag == "Player") {
}
}
function OnGUI() {
GUILayout.Label(labelText);