Search Unity

Audio AudioSettings.Reset() - Keep music playing?

Discussion in 'Audio & Video' started by JanDawid, May 8, 2017.

  1. JanDawid


    Jul 7, 2014
    So I have an option in my pause menu in which you can change the speaker mode. I do this via:

    Code (CSharp):
    1. AudioConfiguration ac = new AudioConfiguration ();
    2.         ac = AudioSettings.GetConfiguration ();
    3.         if (useS51) {
    4.             ac.speakerMode = AudioSpeakerMode.Mode5point1;
    5.         } else {
    6.             ac.speakerMode = AudioSpeakerMode.Stereo;
    7.         }
    8.         AudioSettings.Reset (ac);
    However; as soon as this is called, the music in the level stops playing. If the music is stopped and played again, manually, then the music plays as normal. I'd rather not go through the hassle of resetting every audio source in the scene so is there any other way to keep the music playing and being able to change the speaker mode?

    I'm using Unity 5.4.4f1 (64-Bit) on Windows 10.

    Thank you.
    IsraelVipe likes this.
  2. IsraelVipe


    Nov 7, 2017
    Almost 7 years laters, i have the same problem, and this is the only post i found of someone talking about it, did you solve it? i tried to play the music right after using .Reset() but it still stops for a moment and then plays again, I need it to never stop.
  3. SeventhString


    Unity Technologies

    Jan 12, 2023
    The somewhat big hiccup we have right now with the audio engine is that whenever settings are changed, it has to reset, and this has numerous side-effects. Stopping audio sources is likely one of these.

    For the music, you could store the position before the reset and seek to it once it's done. I know it's not pretty, but it would work!