Greets!
I want to delay the music of my scene 15 sec after start, got this script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DelaySound : MonoBehaviour
{
public AudioSource myAudio;
// Use this for initialization
void Start () {
StartCoroutine(PlaySoundAfterDelay(myAudio, 15000f));
}
// Update is called once per frame
void Update () {
}
IEnumerator PlaySoundAfterDelay(AudioSource audioSource, float delay)
{
if (audioSource == null)
yield break;
yield return new WaitForSeconds(delay);
audioSource.Play();
}
}
but the music still start at the beginin of the scene…
Any help?