How do i have explosion effect after my object destroyed?

I am having Game object i have made prefab of this game object and already added particle system to my prefab. I have placed this game object in the scene and i started my particle system without instantiate it in my code. Now i want to make explosion effect after i destroy my game object,… So what should i do for this?? Please Guide me. Thanks for your help and support in Advance.

here is my code [Edited] :

function Shoot(){
	if (shotSound) audio.PlayOneShot(shotSound); // play the shot sound
   	var hit: RaycastHit;
	//var ray : Ray = Camera.main.ViewportPointToRay (Vector3(0.5,0.5,0));
	var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
	//var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition); 
	
	if (Physics.Raycast (ray ,hit ,200))
	{
	    Debug.DrawRay (ray.origin, ray.direction * 10, Color.yellow);
	    var pickupSpawnPoints:GameObject = hit.collider.gameObject;
	    var clone : GameObject;
  		
	    if(pickupSpawnPoints.tag == "Pickup")
	    {
   		clone = Instantiate(explosion,GameObject.FindGameObjectWithTag("Player").transform.position, transform.rotation);
		Destroy(hit.collider.gameObject , 5);
	    }
	}	   	   
}

A simple C# script:

public Explode : MonoBehaviour {
   public ParticleSystem explosion;

   public void Explode( Vector3 position ) {
      Instantiate( explosion, position, Quartenion.identity );
   }
}

You should call the Explode( transform.position ) right before your object is Destroy(). You can either have this as a separate script or you can incorporate it into your existing script, it largely depends on your code structure.

One easy way is to differ the destroy of your game object. Instead when the game object is hit hide it:

renderer.enabled = false;

Depending on your game, you may also have to:

collider.enabled = false;
rigidbody.active = false;

The you can do something like:

Invoke("DelayedDestroy", 1.5f);

Which calls this method 1.5 seconds later:

void DelayedDestory() {
   Destroy(gameObject);
}

You can also attach the particle system to another game object and either Instantiate() or move that game object to the position of the explosion just before you destroy the game object. If you have only one explosion at a time, this solution would work well.

If you are a absolute beginner then you should go to this link ----> 3dBuzz.com

And as the concern with your answer @robertbu and @Chronos-L both have pointed Good ways to Solve your problem

Don’t Forget to mark the answer if found useful…Enjoy…Cheers…