Search Unity

MusicPlayer Singleton Works in Editor, but not in Build

Discussion in 'Editor & General Support' started by SetumupJoe, Apr 4, 2019.

  1. SetumupJoe

    SetumupJoe

    Joined:
    Aug 13, 2018
    Posts:
    1
    Hello folks,

    Having an issue with a singleton in my game that controls the music that plays throughout. It works perfectly fine inside the Unity editor, with all the right tracks playing on all the right scenes. However, when I build the game and run it the splash screen music carries over onto the main menu, and then all the music that plays is one level behind what is actually should be. That is to say that if you go to the settings menu, the main menu music plays. When you go back to the main menu, the settings theme plays. Then going into level one, the main menu theme plays. I can't for the life of my figure this one out since it works perfectly fine within the editor.

    Here's a link to my MusicPlayer.cs script, if you need any more info let me know.
    https://gist.github.com/SetumupJoe/b4fc303ae995711132ba7c1562f1c687

    Many thanks friends!