I noticed a bug with the music in the game. My volume settings were saving correctly but whenever I exited the game and started it again the volume went back to its default levels. The volume only changed to the player pref level when I accessed the options screen. This is because when the game initially loads the music player is not setting the volume to what’s in the player prefs. I added the following line to the OnlevelWasLoaded(int level) method in the MusicManager class:
audioSource.volume = PlayerPrefsManager.GetMasterVolume();
This fixed my problem. The full method looks like this:
private void OnLevelWasLoaded(int level)
{
Debug.Log("Playing clip: " + levelMusicChangeArray[level]);
var thisLevelMusic = levelMusicChangeArray[level];
if(thisLevelMusic)
{
audioSource.volume = PlayerPrefsManager.GetMasterVolume();
audioSource.clip = thisLevelMusic;
audioSource.loop = true;
audioSource.Play();
}
}