- Home /
playing sounds after each other
hey guys,
I want to have 2 sounds playing on the same object on trigger, but after each other preferrably with a delay how to go about that in C#?
Comment
Best Answer
Answer by WinterboltGames · Aug 24, 2017 at 12:01 PM
You can make a coroutine and use the yield return new WaitForSeconds(...)
like this...
private IEnumerator PlaySounds ()
{
// Play the first sound
AudioSource.PlayClipAtPoint(yourClip, transform.position);
//Then wait 3 seconds and play the other
yield return new WaitForSeconds(3);
AudioSource.PlayClipAtPoint(yourClip, transform.position);
}
and then...
private void OnTriggerEnter ()
{
StartCoroutine(PlaySounds());
}
Answer by linelade · Aug 24, 2017 at 01:44 PM
worked like a charm! thanks a million :) and so simple!
then accept the answer so, it can be moved to answered questions list
ah shoot sorry i thought i allready did it
Your answer
![](https://koobas.hobune.stream/wayback/20220612133435im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Button audio get cut when pressing it 2 Answers
Script to trigger all audio playing to stop, and play a different audio? 1 Answer
Only one audio active. Others do not activate 2 Answers
Glitched Music 0 Answers