How to script a MusicPlayer?


I have two tracks of music(an intro track and a loop track),i need and a script that plays the Intro track once(as the game starts) and following it(exactly after it’s ending) I want the loop track to begin and fell in loop.

Can anybody help me with that?

Any helps would be appreciated!

here you go this is 1 way

    AudioSource MpPlayer;
    AudioClip FirstClip;
    AudioClip SecondClip;
	// Use this for initialization
	void Start () {
        MpPlayer.clip = FirstClip;
        MpPlayer.loop = false;

    IEnumerator WaitForTrackTOend()
        while (MpPlayer.isPlaying)

            yield return new WaitForSeconds(0.01f);
        MpPlayer.clip = FirstClip;
        MpPlayer.loop = true ;

edit shit should work now i forgot to call the second function

please follow link bellow and download asset.
-best example for music player(almost everything included)

Don’t forget to leave your review