Coroutine waitforseconds seems to delay audio in WebGL build. Is there a fix?
I built my game in WebGL so I could run it on a domain so it can be easily accessed by anyone. In the game, I have points where I pan the camera to particular locations and back to the player. Some of these movements have durations that they wait using yield new return WaitForSeconds(time) so the movement does not happen instantly. The issue I was noticing was that sound effects that are playing at this time get off sync with when they are supposed to happen. I have an animation that plays whenever the sound restarts (loops) and after interacting with an object that activates one of these coroutines, the animation is still playing at the same rate that it was, but the sound itself is delayed a bit. The odd part is that this does not occur in the Unity scene editor, Mac OSX builds or in a Windows builds. Is there any reason as to why this could be happening only in WebGL and is there a fix? It makes the gameplay a bit odd if the sound is delayed everytime the player interacts with an object that pans the camera.
Does anyone know if I put my audio files in streamingAssets folder if this will fix the delay? I would try it put I can't seem to wrap my head around how it works, so I would rather not try to fix a problem by creating more problems.
Your answer
Follow this Question
Related Questions
How can i change the value of a variable from an IEnumerator 0 Answers
Probuilder Polybrush meshes not rendering in webgl 0 Answers
C# Simple delay at void Update? 2 Answers
Delay Animator Action in C#? 0 Answers
Wait for 7 Seconds not working 1 Answer