Destroying object without interrupting audio source?

I want my rocket to be destroyed when it collides with something but I also want my explosion sound playing when it collides. Since an audio source gets destroyed along with the object when you destroy that object, you can’t maintain the explosion sound. Any ideas? Thanks.

I had a problem with something similar. I solved it by doing the following. Rather than using the usual AudioSource.Play(), I used AudioSource.PlayClipAtPoint().

You provide the SoundClip to play, as well as the position to play it at in the form of a vector. You can use the rocket’s own transform position for that. Then, you Destroy() the rocket.

How about something like:

collider.enabled = false;
renderer.enabled = false;
Destroy(gameObject, 2.0);

This code hides the game object, disabled the collider, and waits 2.0 seconds to do the Destory(). You will need more code if there are child game object that are visible or have colliders.