Hi
How do you select a root object from a child's script without doing GameObject.Find("")?
I have a door with a trigger child, and I can't do GameObject.Find, because there are multiple objects with the same name (Building01), and the trigger will only open one door out of, let's say, three buildings.
Besides renaming the building, is there any advice out there that can help me?
Thank you
This is my code for the trigger :
private var door:DoorOpen; var DoorTarget:String="";
function Start() { door=gameObject.Find(DoorTarget).GetComponent("DoorOpen"); }
function OnTriggerEnter(other : Collider) { if(other.gameObject.name=="MainCharacter") { door.openDoor(); } }