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

        source = GetComponent <AudioSource>();

        instance = this;
        DontDestroyOnLoad(gameObject);
    }
예제 #9
0
 private void Awake()
 {
     DontDestroyOnLoad(transform.gameObject);
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
예제 #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);
 }
예제 #11
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

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

        DontDestroyOnLoad(gameObject);
    }
예제 #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);
 }
예제 #13
0
 void OnApplicationQuit()
 {
     _instance = null;
 }