I have a game object which has 10 child objects, which are all coins. I set up a killregion on the left of the screen that I want to use to destroy everything that touches it.
Here’s what I’m using for the KillRegion:
#pragma strict
function Start ()
{
}
function Update ()
{
}
function OnTriggerEnter (other : Collider)
{
Destroy(other.gameObject);
}
The individual coins are all objects with their own box colliders because I want the player to be able to collect them individually. The parent coin group object only has a transform component. The individual coins are all set to be triggers. I’ve read the information about Object.Destroy and I can’t come up with a solution that destroys the children and the parent. I’ve also tried making the Kill Region a trigger but that didn’t lead me anywhere promising yet. Any insight would be great! Thanks!