Thursday, September 22, 2022
HomeGame Developmentc# - AudioSupply.isPlaying is just not working in Unity WebGL Build

c# – AudioSupply.isPlaying is just not working in Unity WebGL Build


I’m passing a clip to play on the audio supply. Next, I anticipate the audio to complete to invoke the following motion.

But the ready loop by no means ends. Once the audio clip ends, the time I learn from audioSource.time restarts from the start with out taking part in the clip (so it is not audibly looping).

I’ve tried checking the situation audiosource.isPlaying, however that is by no means false, so it stays within the loop.

IEnumerator PlayAudioClip(AudioClip clp)
{
    audioSource.clip = clp;
    audioSource.Play();
    whereas (audioSource.isPlaying)
    {
        Debug.Log("Audio Playing "+audioSource.time + ", " + clp.size);
        yield return new WaitForEndOfFrame();
    }
    //Doing some motion
}

In this screenshot, you possibly can see the time get to the tip and begin over:

Sample debug output, showing time ticking forward, then starting over

Note: It’s working as anticipated within the editor. It’s not working solely within the WebGL Build.

I’m utilizing Unity 2021.3.5f1

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments