Detroy object on collision and explode

Hi there,

How can I check for collision withing the function Update () part?

I need to check if my sphere has collided with anything, and if true, destroy the object and play my explosion.

I tried multiple codes and functions but none seem to work. my test sphere and the box it collides against, both have rigid bodies attached to them.

Here is one of the codes I tried:

function OnCollisionEnter(collision : Collision) {
    if (collision.rigidbody) {
    collision.transform.rigidbody.AddForce (Vector3.up * 100);

But I cant use this function under update... What can I do?

you can't use it in function Update because it is a function in itself. The code you tried isn't for making an explosion its for moving a rigidbody up when it collides with something. If you don't understand scripting take some tutorials 1st before blindly asking question here and expecting someone to just give you the answer. It makes you look like a right idiot, this question has been asked before and the fact you cant even be bothered to search for it shows you don't have grasp of anything Unity related.

function OnCollisionEnter(collision : Collision)
    Instantiate (ExplosionPrefab,transform.postion,transform.rotation);
    Destroy (gameObject);

basic stuff, use script reference to check for the syntax and how to use it, otherwise google, Unity 3D javascript tutorials and go learn something instead of asking questions in the dark hoping someone will be generous enough to fix your very simple problems when you can't be bothered to work it out yourself.