Hello, I am using Unity3d 4.6 UI which include the GUI for toggle the Sound. How could I turn off/on the sound using C#. I appreciate your help, Aprial
You can disable with "barbarian" code: Code (CSharp): int Count; int Leght; void Start() { AudioSettings.GetDSPBufferSize(out Leght,out Count); } public void ChangeSound(bool Boolean) { if (Boolean) { AudioSettings.SetDSPBufferSize(0, 0); } else { AudioSettings.SetDSPBufferSize(Leght, Count); } } Add ChangeSound() on OnValueChanged(Boolean) on your toggle. Note: That cause small lag and stop the music, when you re-on.