I have an audio loop that plays throughout the whole game. I want to destroy it when the Main Menu loads. (Or when the game is restarted.)
How can I check if a certain level was loaded so I can properly use Destroy(this)? Thanks!
Here’s a script I thought would work but its throwing an error:
function Update () {
DontDestroyOnLoad(this);
if (Application.loadedLevel (0)) {
Destroy(this);
}
}