Changing Audio Settings In Unity 5 With Public API

Changing Audio Settings In Unity 5 With Public API

Symptoms

  • The docs state that in Unity 5 you can no longer set the speakerMode via API, but instead must use project settings->audio to set this

Cause
Setting AudioSettings.speakerMode is deprecated and has been replaced by audio project settings and the AudioSettings.GetConfiguration/AudioSettings.Reset API

Resolution

In Unity 5, if you want to change the AudioSettings, the new API must be used:

        

AudioConfiguration _audioConfig = AudioSettings.GetConfiguration ();
        _audioConfig.speakerMode = AudioSettings.driverCapabilities;
        AudioSettings.Reset (_audioConfig);

Was this article helpful?

Related Articles