void Awake() { //Debug.Log ("Music player AWAKE " + GetInstanceID()); if (instance != null) { Destroy(gameObject); } else { instance = this; GameObject.DontDestroyOnLoad(gameObject); } }
void Awake() { //Debug.Log ("Music player AWAKE " + GetInstanceID()); if (instance != null && instance != this) { Destroy(gameObject); } else { instance = this; GameObject.DontDestroyOnLoad(gameObject); music = GetComponent <AudioSource>(); music.clip = startClip; music.loop = true; music.Play(); } }