hello,
I made a 2d platformer with 4 level. now I want to make one song in level 1 and 2 and an other song in level 3 and 4.
I made a gameobject with audiosource in level 1 and attached this script (because I don’t want to start the song from the beginning when I am respawn)
private static var instance:MyUnitySingleton;
public static function GetInstance() : MyUnitySingleton {
return instance;
}
function Awake() {
if (instance != null instance != this) {
Destroy(this.gameObject);
return;
} else {
instance = this;
}
DontDestroyOnLoad(this.gameObject);
}
In level 3 I want to change the song what should I do?