void Awake()
 {
     //Debug.Log ("Music player AWAKE " + GetInstanceID());
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
Esempio n. 2
0
 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();
     }
 }