Trigger explosion on rocket


i need help with how do i trigger an explosion for my rockets when the time is up instead of them just being destroyed.

This is the code im using

var timeOut = 2.7;

var detachChildren = false;

function Awake ()

         Invoke ("DestroyNow", timeOut);


function DestroyNow ()

    if (detachChildren) {
               transform.DetachChildren ();
    DestroyObject (gameObject);


I have downloaded the Detonator Package wich im trying to use for this...

Thanks for your help.....

Just add a reference to a Detonator prefab (from the pack), fill it in using the Inspector, and then instantiate it. It should go off right away if you didn't mess with anything in the Detonator settings.

// Fill this in using the Inspector
var explosion : GameObject;

Then, before you destroy the object, do something like this:

Instantiate(explosion, transform.position, Quaternion.identity);