public void HandleSound() { if (optionsPanelVisible) { optionsPanelVisible = false; optionsPanel.SetActive(false); } int music = GamerPrefs.GetMusicOn(); if (music == 1) { music = 0; GamerPrefs.SetMusicOn(0); } else { music = 1; GamerPrefs.SetMusicOn(1); } Text soundText = soundButton.GetComponent <Text>(); soundText.text = (music == 1) ? "Sound On" : "Sound Off"; willPlay = (music == 1) ? true : false; HandleMainMenuBgMusic(); }
public void HandleSound() { int music = GamerPrefs.GetMusicOn(); if (music == 1) { music = 0; GamerPrefs.SetMusicOn(0); } else { music = 1; GamerPrefs.SetMusicOn(1); } Text soundText = GameObject.Find("Sound Button").GetComponent <Text>(); soundText.text = (music == 1) ? "Sound On" : "Sound Off"; willPlay = (music == 1) ? true : false; HandleMainMenuBGMusic(); }