Flowing Music

Hello,

I’ve just added a music file. I want to use it as the theme song for the menu. However, I want it to flow continuously throughout the different scenes. How do I do that?

Regards,
Silent-11

Ok this is fairly easy you want an empty gameobject that has the audio source on it first. Then make a script that prompts so

function Awake () 
{
   DontDestroyOnLoad (transform.gameObject);
}

or for C#

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
   void Awake() {
      DontDestroyOnLoad(transform.gameObject);
   }
}

then put the script on the object and done the music will keep playing even though you switch scenes! Its that easy!

Wait, now every time I click on the scene that holds the music, the song seems to override. Meaning, one song stacked on top of the other every time I click on the scene that has the song. How do I fix this?