// Update is called once per frame public void SoundON() { SoundONButton.GetComponent <Image> ().enabled = true; SoundOFFButton.GetComponent <Image> ().enabled = false; GameObject BackgroundMusic = GameObject.FindGameObjectWithTag("BackgroundMusic"); AudioListener.volume = 1; }
// Use this for initialization void Start() { GameObject BackgroundMusic = GameObject.FindGameObjectWithTag("BackgroundMusic"); if (AudioListener.volume != 0) { SoundONButton.GetComponent <Image> ().enabled = true; SoundOFFButton.GetComponent <Image> ().enabled = false; } else { SoundONButton.GetComponent <Image> ().enabled = false; SoundOFFButton.GetComponent <Image> ().enabled = true; } DontDestroyOnLoad(gameObject); }