Hello all,
I am trying to create a segment of hallway that when the player passes through a plane it renders, and when the player passes through the second plane it is destroyed. I am able to use the GameObject to select the parent hallway for the second plane with no problem, however I can not select the parent for the first plane. I would appreciate any help or explanation as why this is the case.
Plane 1- Render Hallway (Can only select 1 object, parent renders before trigger)
var hall : GameObject;
var played = false;
var trig = false;
function Start () {
trig = false;
hall.GetComponent.().enabled = false;
}
function OnTriggerEnter (other : Collider) {
trig = true;
}
function Update () {
if (trig == true) {
hall.GetComponent.().enabled = true;
}
else {
hall.GetComponent.().enabled = false;
}
}
Plane 2- Destroy Hallway (Can select parent as GameObject)
var hall : GameObject;
var played = false;
var trig = false;
function Start () {
trig = false;
hall.GetComponent.().enabled = false;
}
function OnTriggerEnter (other : Collider) {
trig = true;
}
function Update () {
if (trig == true) {
Destroy(this.gameObject);
Destroy(hall.gameObject);
}
}
Thank you all in advance,
Respectfully,
Gabriel
↧