how to play audio at a given time.

how to play audio at a given time,i mean i wanted to play audio after 1 min in the game.
anyone please.

thank you

var foo : AudioSource;

function Update () {
	
	if (!foo.isPlaying && Time.time >= 60) {
		foo.Play();
	}
}

Simple as that. :wink:

Hope that helps, Klep

You can use coroutines. Following code is in C#, but JS is quite similar.

IEnumerator PlaySoundAfterDelay( AudioSource audioSource, float delay )
{
    if( audioSource == null )
        yield break;
    yield return new WaitForSeconds( delay );
    audioSource.Play();
}

And to use it, you just need to start the coroutine:

public AudioSource myAudio;

void Start()
{
    StartCoroutine( PlaySoundAfterDelay( myAudio, 60.0f ) );
}