How do I have the music running in the background even if the current scene reloads?

Hey all, how do I have the music running in the background even if the current scene reloads? I’m using this for whenever the player dies / game over. I am using DontDestroyOnLoad(musicManager);, but that just creates a new music manager, which then will run another music on top of the original music. If anyone have any ideas, please do tell me! Appreciate all advice. Thanks in advance!

Also, this is the code for GameOver() state:

    public void GameOver()
    {
        DontDestroyOnLoad(musicManager);

        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }

Check to see if you have a music object active brfore spawning a new one.
Try looking for the object with Find() or have a static bool telling you.

Don’t make your music manager object a part of your scene. Make it a prefab that you instantiate. Set it to DontDestroyOnLoad, and give it a unique tag. When your scene loads you FindWithTag for your music manager. If it returns an object you do nothing, if it returns null you instantiate your music manager object from the prefab.

Thank you for the suggestion! I have successfully implemented the system now :slight_smile: