- Home /
Delay between clicks and sound
I have this code inside OnGUI()
//BLA BLA
//when click button
StartCoroutine(PlayAudio(click,"email"));
//BLA BLA
and this method
private IEnumerator PlayAudio (AudioClip clip,string control)
{
audio.volume = 1.0f;
audio.loop = false;
audio.clip = clip;
audio.Play ();
yield return new WaitForSeconds(audio.clip.length);
//BLA BLA I do this after sound finish
}
The problem is that the sound doesnt start when i click but after a few millisecond,and I do not why.
$$anonymous$$aybe its because you are using mp3 files which always have a delay in the start, try using .wav or .ogg format.
THis is very useful! Thx The situation is a bit better but there is still a delay. On unity there is no delay, but it happen when I load the app inside the Ipad. I noticed this right now
Answer by MakeCodeNow · Feb 17, 2014 at 05:41 PM
Try setting a lower DSP buffer size. I've posted more info on that in other answers here.
It's say: "page not found" can anyone post the solution?
Answer by EdKirby · Dec 27, 2016 at 08:08 AM
As someone pointed out in a comment the original answer's link 404's. Here is an updated link: https://docs.unity3d.com/Manual/class-AudioManager.html
If anyone is curious if this works, this fixed the issue for me as well.
Your answer
![](https://koobas.hobune.stream/wayback/20220613133821im_/https://answers.unity.com/themes/thub/images/avi.jpg)