Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Audio AudioSettings.Reset() - Keep music playing?

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

  1. Jakeiiii

    Jakeiiii

    Joined:
    Jul 7, 2014
    Posts:
    258
    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.
     
unityunity