public Toggle mute; public Text lable; public GameObject camera; if (mute.isOn == true) { camera.GetComponent<AudioListener>().enabled = false; lable.text = "Sound Off"; File.WriteAllText((Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Pong/audio.data")), "0"); } else if (mute.isOn == false) { camera.GetComponent<AudioListener>().enabled = true; lable.text = "Sound On"; File.WriteAllText((Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Pong/audio.data")), "1"); }
string line1; string file = (Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Pong/audio.data")); StreamReader s1 = new StreamReader(file); if ((line1 = s1.ReadLine()) == "0") { camera.GetComponent<AudioListener>().enabled = false; } else { camera.GetComponent<AudioListener>().enabled = true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)