problem with sound

var timer:float;
var timerOn:boolean;
var explosion:GameObject;

//sound
var explodeSound:AudioClip;

function Start()
{
	timerOn = true;
	timer =0.0;
}

function Update () 
{
	if(timerOn==true)
	{
		timer += Time.deltaTime;
		if(timer>=5.0)
		{
			audio.PlayOneShot(explodeSound);
			for(i=0;i<25;i++)
			{
				Instantiate(explosion,gameObject.transform.position,
				gameObject.transform.rotation);
			}
			Destroy(gameObject);
		}
	}
}

unity doesnt give me any error msg but the sound doesnt play when it should :frowning:

(i attached the sound already , my object is prefab )

help me plss thx

Looks like you’re destroying the game object that has the audio source on it. Try using an audio source attached to a live game object and see if it behaves better.

but i attached the sound on the prefab… so i think every object that created using this prefab will have the same sound , isn’t it?? im not sure though …audio source? how to do that?