Example #1
0
 public void turnMusicOff()
 {
     if (_instance != null)
     {
         //if (instance.audio.isPlaying)
         //    instance.audio.Stop();
         Destroy(this.gameObject);
         _instance = null;
     }
 }
Example #2
0
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     if (instance == null)
     {
         instance = this;
     }
     else {
         Destroy(this.gameObject);
     }
 }
 // Background audio continues to play after changing the scene
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Example #4
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(transform.gameObject);
     }
 }
Example #5
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }
Example #6
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Example #7
0
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
    void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(gameObject);
            return;
        }

        source = GetComponent <AudioSource>();

        instance = this;
        DontDestroyOnLoad(gameObject);
    }
Example #9
0
 private void Awake()
 {
     DontDestroyOnLoad(transform.gameObject);
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Example #10
0
 // Use this for initialization
 void Awake()
 {
     //there's no audio
     if (instance == null)
     {
         instance = this;
     }
     //audio already exists and this instance is not the original
     else if (instance != this)
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(this.gameObject);
 }
Example #11
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(this.gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Example #12
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
     // GameObject[] objs = GameObject.FindGameObjectsWithTag("Music");
     // if(objs.Length > 1){
     //  Destroy(this.gameObject);
     // }
     // DontDestroyOnLoad(transform.gameObject);
     DontDestroyOnLoad(this.gameObject);
 }
Example #13
0
 void OnApplicationQuit()
 {
     _instance = null;
 }