Menu Music/Game Objects passing between scenes
by David on May.20, 2010, under Unity Scripts
This is a very useful script to use when you want to be able to choose when / how to pass a game object onto another scene and then be able to return to a previous scene without ending up with duplicate objects.
(The script was taken from Unity Answers area on their site at the address below:)
http://answers.unity3d.com/questions/3863/audio-or-music-to-continue-playing-between-scene-changes
private static var instance:MusicHandler;
public static function GetInstance() : MusicHandler
{
return instance;
}
function Awake ()
{
if (instance != null && instance != this)
{
Destroy(this.gameObject);
return;
}
else
{
instance = this;
}
DontDestroyOnLoad(this.gameObject);
}

