- Home /
audio.ignoreListenerPause
Hi i have been doing some research and apparently there is a bug in 4.1 where this doesn't work.
(audio source that has this to true will play through even if the listener is paused)
I was wondering if it does work in 4.1 or any version?
so when you pause the listener the audio is still playing?
i want the background music to continue playing when the listener is paused
Answer by Fornoreason1000 · Nov 23, 2013 at 05:37 AM
After some testing and replication, I found that there's a small glitch in that system which requires you to disabled then re enable the audio source again. weird, it doesn't mention that in the docs. you should probably submit a report on this one.
http://docs.unity3d.com/Documentation/ScriptReference/AudioSource-ignoreListenerPause.html http://docs.unity3d.com/Documentation/ScriptReference/AudioListener-pause.html
however the code below gets it working in the meantime. my guess is that it fails to detect changes to ignoreListenerPause when you set it, but pick it up when you enable it.
public AudioSource a;
// Use this for initialization
void Start () {
a = gameObject.GetComponent("AudioSource") as AudioSource;
AudioListener.pause = true;
a.ignoreListenerPause = true;
a.enabled = false;
a.enabled = true;
}
enabled after ignoreListenerPause does not appear to resolve the issue in 4.3.3f :(
Your answer
Follow this Question
Related Questions
Pause Menu Audio 1 Answer
4.1 audio pause set to true on level load? 1 Answer
Audio keeps playing when paused 1 Answer
Two Audio listeners 1 Answer
Mute/Unmute not working with new sounds 2 Answers