Adding colliders

Hi, i just tried to make a “J” letter object in my game, putting 3 cubes together, but i want to disappear it when my character touch it. I made a Game Object and inside are the 3 cubes that conform the letter “J”, i just add a collider to the Game Object, and enabled the isTrigger option, but it doesn´t work, and i did the same with the 3 cubes but nothing. I got a coin that works perfectly with colliders, but i don´t know what´s wrong with this Game Object, thanks…

try adding this to the player

// Whoever enters the DeathTrigger gets an OnDeath message sent to them.
    // They don't have to react to it.
    function OnTriggerEnter (other : Collider) {
    	other.gameObject.SendMessage ("OnDeath", SendMessageOptions.DontRequireReceiver);
    }`enter code here`

and this to the cubes

function OnDeath(){

    Destroy(gameObject);

}

You should post your script! Anyway, I suggest you to do the following:

1- Create an empty game object, move it to the J position and child the three cubes to it;

2- Add a capsule collider to the empty object, adjust its dimensions to enclose the J and set Is Trigger;

3- Add a script like this to the empty object:

function OnTriggerEnter(other: Collider){
  if (other.tag == "Player"){ // remember to tag the player as "Player"!
    Destroy(gameObject); // this will destroy the children too
  }
}

You said that all the Cube Gameobjects are children of a J gameobject with a collider component right? Is it possible that you’ve added for instance, a mesh collider to the parent GameObject with no mesh?

It may be the case that you need to add Mesh/Box colliders to the actual Boxes themselves, in order to get the OnTriggerEnter function to fire properly.

Just a shot in the dark, hope it helps…