how to stop Playing Audio in Required Scene
Hello i used the following Script to Keep Playing Audio Music in different First 2 Scenes...
Now i Want to Stop This Audio Music in Scene 3
What changes i do in this Script to Stop Music in scene 3,4 etc
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class BGSoundScript : MonoBehaviour {
 
     // Use this for initialization
     public AudioSource Audio;
 
     void Start () {
         
     }
 
     //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);
     }
 
 
     //Play Gobal End
 
     // Update is called once per frame
     void Update () {
         
     }
 }
 
               Please Help Me
Answer by aldonaletto · Aug 02, 2017 at 05:34 AM
You can pause the music with the following instruction:
     BGSoundScript.Instance.Audio.Pause ();
 
               In order to resume the music, use:
     BGSoundScript.Instance.Audio.Play ();
 
               These commands may be part of any C# script, like this one:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class MusicControl: MonoBehaviour {
 
     public bool musicOn = true; // this variable appears in the Inspector and controls the music
 
     void Start(){
         if (musicOn){
         BGSoundScript.Instance.Audio.Play ();
         } else {
         BGSoundScript.Instance.Audio.Pause ();
         }
     }
 }
 
               Attach this script to the camera in every scene and set the field Music On to true or false in order to enable/disable the music in each scene.
Your answer
 
             Follow this Question
Related Questions
Loot table problems 1 Answer
Game crashes on iPhone 11 0 Answers
Need help with Mute Button 1 Answer
How do i have game object in the middle of a Catmull spline? 0 Answers
how to move a rigidbody ball or kick a ball from swipe gesture 0 Answers