I have a setup where I am building a maze recursively with square tiles. To try and limit the squares that a maze tile can be placed in, I’ve set up each tile with several children box colliders. These children are supposed to toggle a boolean in the parent script, but the children’s tags don’t affect the parent script, so the booleans are never toggled. Can I use the tag from the child in the parent’s collision script?
The C# snippet is from the parent object. open is a bool array, countOpen is a counter
void onTriggerEnter (Collision other) {
if (this.tag.Equals("box4")) {
open[3] = false;
countOpen--;
}
if (this.tag.Equals("box3")) {
open[2] = false;
countOpen--;
}
if (this.tag.Equals("box2")) {
open[1] = false;
countOpen--;
}
if (this.tag.Equals("box1")) {
open[0] = false;
countOpen--;
}
}
Is there a method objects can invoke to get the tag from a child object during a trigger event? If you need more details I’d be happy to supply them when I return.