Beispiel #1
0
	void Awake() {
		if (bgmHandler == null) {
			DontDestroyOnLoad (gameObject);
			bgmHandler = this;
		} else if (bgmHandler != this) {
			Destroy(gameObject);
		}
	}
Beispiel #2
0
 // Use this for initialization
 void Awake()
 {
     if (BGM == null)
     {
         BGM    = this;
         source = GetComponent <AudioSource>();
         DontDestroyOnLoad(this);
     }
     else
     {
         Destroy(this);
     }
 }