- Home /
The question is answered, right answer was accepted
simple problem. I alt tab and audio in Unity stops playing
I have audio playing from something in my scene. I click onto another program, say, monodevelop. The audio stops playing. I click back, and it continues. Or it would, except I have a script that checks if Audio.IsPlaying so it knows when to switch tracks. so now when I click back, it changes the track. Kind of annoying. Any suggestions on how to fix this?
in player settings, do you have it set to run in background? that might be a part of it
Got an answer from another forum: Use Monobehaviour's OnApplicationFocus to store if your app is focused; don't check isPlaying if it's not in focus
Answer by tswalk · Jun 23, 2014 at 07:13 AM
I'm guessing you are on a Windows PC.
This could be related to the systems audio drivers being handled in "exclusive" mode, you can test to see by going into the audio driver properties panel (control panel > sound > select speakers (or headphones if that's what you use) > advanced tab)
and disable "Allow applications to take exclusive control of this device"
you may have to reboot for the changes to take affect.
Why would this be helpful if the point is to make the game function correctly for all end users rather than only fix it on your own computer
Follow this Question
Related Questions
Audio Priority problems... 0 Answers
Audio doesn't work in editor? 6 Answers
Using input.getbuttondown to play audio = NOT WORKING? :( 2 Answers
Song Allowments 1 Answer
How do I reduce the CPU load spike caused by playing an audio clip? 1 Answer