I’m trying to instantiate a GUITexture only once, and only if the player is in the trigger box that i made. However when i instantiate with the following script it keeps making copies since im in the trigger constantly. How do i instantiate my guitexture once?
script:
var doorUp : AnimationClip;
var openDoorText : GUITexture;
function OnTriggerStay (mytrigger : Collider) {
if(mytrigger.gameObject.name == “player” )
{
door = gameObject.Find("door");
var instance : GUITexture = Instantiate(openDoorText, transform.position, Quaternion.identity);
if(Input.GetButton(“openDoor”))
door.animation.Play("hoistDoorUp");
}
}