hello,
i want to know that , how can you destroy multiple gameobject in a single collision.
I had five cube object in my scene and i was trying to destroy every single cube, when anyone of the cube detects collision.
Can somebody help me…
hello,
i want to know that , how can you destroy multiple gameobject in a single collision.
I had five cube object in my scene and i was trying to destroy every single cube, when anyone of the cube detects collision.
Can somebody help me…
You are a little vague on what you want here. From what I understand, you want one collision to trigger the destruction of multiple boxes. If that is what you are trying to achieve, then something like this should work.
//number of boxs in scene
public int boxNum = 5;
void onCollision(){
for(i = 1; i < boxNum; i++){
Destroy(GameObject.Find("Box");
}
}
Whenever you get a collision, if you use the method onCollision now it should destroy all boxes.