I have my audio source set up on an empty gameObject with this code in the Update function:
if (Application.loadedLevelName == "mainMenu")
{
Destroy(this.gameObject);
}
else
DontDestroyOnLoad(this.gameObject);
When I die, it takes me to a retry scene, I don't want the audio source to be destroyed unless it goes back to the main menu, the probelm is, when I click retry and reload the level, the empty gameObject audioSource carries over, but then another instance of the audio starts and there's two copies of it playing.
Is there a way I can get around this? Thanks
↧