Hello! I’m making a main menu and wanted continuous music running through each menu scene. The script does what I want. But when I load mission #1… the music is still playing and wont stop. Please Help.
Script:
#pragma strict
static var currentScore : int = 0;
var offsetY : float = 40;
var sizeX : float = 100;
var sizeY : float = 40;
var musicPrefab : Transform;
function Start () {
currentScore = 0;
if (!GameObject.FindGameObjectWithTag("MM")) {
var mManager = Instantiate (musicPrefab, transform.position, Quaternion.identity);
mManager.name = musicPrefab.name;
DontDestroyOnLoad (mManager);
}
}