Quantcast
Channel: Latest Questions by karl_
Viewing all articles
Browse latest Browse all 90

audio.PlayOneShot() not responding consistently on iPhone builds

$
0
0

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)

Viewing all articles
Browse latest Browse all 90

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>