I’m working on a rhythm game, and need audio to be played at the exact time the notes start. Would I be correct in using AudioSource.PlayDelayed(time) to ensure that the audio starts at the correct time every time? I know audio is handled on separate threads, so I believe I’d read that delaying the audio will ensure that it starts at the correct time.
As for the coroutine question, I have implemented a load screen and would like to make sure I’m doing it the right way.
In my controller object, I have:
StartCoroutine(Load());
Inside of the Load() function, I have:
WWW song = new WWW("file:///" + Directory + "\\Song.ogg");
//I load the song at runtime so it's easier to add songs
while (!song.isDone)
{
yield return null;
}
AudioSource.clip = song.GetAudioClip(false);
LoadNotes();
//Loads the notes
SetUpEverythingElse();
//Set up everything else
AudioSource.PlayDelayed(1.5f);
Invoke("StartSong", 1.5f);
//StartSong() pretty much just enables everything else that needs to be enabled for the notes to scroll