[ad_1]
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:
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
[ad_2]