stop audio to all scenes using slider in main menu in unity
I am using different sounds in differnt scenes but problem is that i can't stop all sounds using slider in menu it's only stop menu sound or sound for scene but when my game over menu button appear i clicked on that then sound new apear as i am using DontDestroyOnLoad in Background script
public class BGSoundScript : MonoBehaviour {
// Use this for initialization
void Start () {
audioSrc = GetComponent<AudioSource>();
}
//Play Global
private static BGSoundScript instance = null;
public static BGSoundScript Instance
{
get { return instance; }
}
void Awake()
{
if (instance != null && instance != this)
{
Destroy(this.gameObject);
return;
}
else
{
instance = this;
}
DontDestroyOnLoad(this.gameObject);
}
public void SetVolume(float vol)
{
musicVolume = vol;
}
//Play Gobal End
}
//i am using BGSoundScript.Instance.audioSrc.Play(); and //BGSoundScript.Instance.audioSrc.Pause(); in other script but that also not //work for me