public void SoundButton() { //In player prefs, the "Sound" key is for sound //If sound == 0 mute, if sound = 1 unmute if (PlayerPrefs.HasKey("Sound")) { if (PlayerPrefs.GetInt("Sound") == 0) { soundButton.sprite = musicOnSprite; PlayerPrefs.SetInt("Sound", 1); soundManager.AdjustVolume(); } else { soundButton.sprite = musicOffSprite; PlayerPrefs.SetInt("Sound", 0); soundManager.AdjustVolume(); } } else { soundButton.sprite = musicOffSprite; PlayerPrefs.SetInt("Sound", 1); soundManager.AdjustVolume(); } }
public void SoundButton() { if (PlayerPrefs.HasKey("Sound")) { if (PlayerPrefs.GetInt("Sound") == 0) { PlayerPrefs.SetInt("Sound", 1); musicButton.sprite = musicOnSprite; sound.AdjustVolume(); } else { PlayerPrefs.SetInt("Sound", 0); musicButton.sprite = musicOffSprite; sound.AdjustVolume(); } } else { PlayerPrefs.SetInt("Sound", 0); musicButton.sprite = musicOffSprite; sound.AdjustVolume(); } }