odd audio delay

function warning_action() { if(warning==false) { moving= false; model_swap("o"); StopCoroutine("re_enable_moving");



so heres the problem, this function is a tiny behavior of my AI whats happening here is my AI goes through a subtle warning stage to alert the player to GTFO when it gets to the animation the AI Stands up and its also supposed to play an audio track now it plays the animation however it wont play the audio or more precisely it wont play the audio till this function completes instead of directly when i call it like i want it to

another oddity is, you will notice the if(audio isnt playing) condition yeah, so if the audio does stop playing it would have finished this function naturally however IT NEVER finishes naturally, it always finishes with my external condition, then plays the audio

so that means, whats happening is the audio is both playing but at the same time not playing help?

-yes i have an audio source, it is playing the sound....eventually -oh and those top 3 commands have no relation to whats going on

This is intended. We sync audio across all scripts and play it at the exact same time (at the end of the frame). In any case, audio will never play right away. You have to wait for the mixer to pick it up. mixes it, pushes it to hardware etc. We have no way to actually know when this happens. That's why isPlaying() is true from Play() is called till it stops.