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