So I created a music player to play music through all my menu and story scenes without interrupting, but then in my game scene I want to delete that music. How can destroy the playing music when my game scene loads?
Here is my music script:
#pragma strict
var offsetY : float = 40;
var sizeX : float = 100;
var sizeY : float = 40;
var musicPrefab : Transform;
function Start () {
if (!GameObject.FindGameObjectWithTag("MM")) {
var mManager = Instantiate (musicPrefab, transform.position, Quaternion.identity);
mManager.name = musicPrefab.name;
DontDestroyOnLoad (mManager);
}
}