I have a click sound that plays when you touch a button, and this works perfectly in Unity. However, on and iPod it only emits sounds sporadically. I'll touch a button once and it will click, then come back to the scene in a minute and it won't click. I've been unable to find a consistent cause.
Anyways, I'm using a very small .wav file, and here is my code:
var clickSound : AudioClip;
function OnGUI()
{
if(GUI.Button ( ) )
{
PlayAudio();
Application.LoadLevel("nextLevel");
}
}
function PlayAudio()
{
audio.PlayOneShot(clickSound);
yield WaitForSeconds(.5);
}
@script RequireComponent(AudioSource)