Enemies wont explode on collision

Before I start, I’m sorry about asking so many question in the past month. I’m such a noob at Unity and i probably should quit using it. So this might be my last question.

For some reason, my enemies won’t explode on collision with anything.

    using UnityEngine;

using System.Collections;



public class OnCollideExplode : MonoBehaviour 

{



// A grenade

// - instantiates a explosion prefab when hitting a surface

// - then destroys itself

public GameObject explosionPrefab;

public float      explodeSecs = -1;



void Awake()

{

        if(explodeSecs > -1) Invoke ("DestroyNow", explodeSecs);

}



void OnCollisionEnter( Collision collision ) 

{

    // Rotate the object so that the y-axis faces along the normal of the surface

    ContactPoint contact = collision.contacts[0];

    Quaternion   rot     = Quaternion.FromToRotation(Vector3.up, contact.normal);

    Vector3      pos     = contact.point;

    Instantiate(explosionPrefab, pos, rot);

    // Destroy the projectile

    Destroy (gameObject);

}



void DestroyNow()

{

    Instantiate(explosionPrefab, transform.position, transform.rotation);

    Destroy (gameObject);

}









}

i dont know how much help ill be, ive only been scripting for about 3 weeks now, and i also use java not C.

Anyway i had similar problems with a little 2d shooter i made while i was learning Java. What i ended up having the best luck with was instead of using OnCollisionEnter, i used OnTriggerEnter and just checked the box in the collider for Trigger. Ill paste my example code in so you can kinda see what i mean.

var explosion : GameObject;

function Update () {
}

function OnTriggerEnter(col : Collider){
if (col.gameObject.tag == “rocket”) {
gameController.totalEnemies -= 1;
Destroy(gameObject);

    Instantiate(explosion, transform.position, transform.rotation);

}

}

In another game ive been playing with, i basically set an integer to increase every time a collision was made, then in a “if” statement i would have the script check for the number of collisions and if it met the number it checked for it would Destroy(gameObject) and Instantiate my explosion prefab. This might be a really bad way to do it, to be honest im not sure. all i know is that both of these scenarios worked for me and i hope that i have helped you.