Sound Lag When Playing Audio

I’m getting some sound lag in my game. Is there any way to stop that?

Example: I press start on the main menu screen. The sound has such a delay that it’s not playing until the stage loads. When I hit an opponent, the sound play when the punch gets back to the idle.

This mistiming is causing a lack of impact feeling.
I didn’t notice it before, but it also happens in the demo provided with the book.

Is there a way to fix that?

@nathansimbahan Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hello @yinyamina,

That is weird. I’m testing the chapter 11 final project and the projects runs fine.

Can you try enabling Load In Background for the audio files in the Inspector? Also try setting the Sample Rate Setting to Optimize Sample Rate.

Hope this helps.

I tried a few things. Preloading, different loading options, audio buffer settings. Nothing worked.
The only thing that worked was I created a build. The sounds are all playing at the right moment in a build. But it would be a hassle to create a build every time I wanted to test a new sound. I guess it’s not a big deal as long as I know it will play properly in the final version. It would really be handy to have it working properly in test mode too though.

+1 here
Even i was facing the same problem
But mine was intermittent
I faced this twice and restarting the application solved the problem for me both of the times

@jamielanger Really glad you fixed it! Cheers! :]

This still happens for me, but I think it’s more of a Unity thing since it happens with all of my projects.