I have two door gameobjects, and inside they have a quad that is used as the trigger, and then an exit for where the PC is supposed to be placed. One works fine but when I add another with the same script, the trigger on the second door transports my character back to the first doors exit position (which is in front of the second door)
My script is just this one function that moves the collider to the exit position:
function OnTriggerEnter (other : Collider) {
other.transform.position = GameObject.Find("Exit").transform.position;
}
Does it have a problem with me trying to Find() the exit? Why wouldn’t it be using the script’s gameObject parent to find the Exit associated with it? I’m sorry if this has come up before, but I couldn’t find anything on the subject. I could have been using the wrong words to search, because I was getting a lot of posts relating to Valve’s Portal.