How to make an event happen after an object is collided with

how can I destroy an object after a different object is collided with?

2 Answers

2

Add this line of code to either of your objects that are colliding...

function OnCollisionEnter() {
    Destroy(gameObject.Find("Box"));
}

Where Box is the name of the object you wish to destroy when the collision happens..

http://unity3d.com/support/documentation/ScriptReference/Object.Destroy.html

Don't hand him a fish man! Put rod in his hand!

Up on the top right there is a white box with a little tiny banjo in it. In there type 'destroy collide' and hit your enter/return key.

Look around a bit and you'll find examples.