Hey guys,
I'm making a very basic 2D game and the entire game has only 2 scenes. However, I want to add background music without breaking connection each time I want to swap between the scenes. I have to say that i'm an artist and my knowledge in c# still really basic, any help from the experts?
Replies
you might still have hiccups during the load, but that should preserve the audio source between scenes
I did exactly the same, but whenever I return to the main menu the audio file duplicates and it overlaps, you can hear it quite clear in the background, any idea whats happening?
If that's not what happening you'll have to show us some code
it would be something like
(if audio.getcomponent<audio>() == false)
{play audio...}
if its true it would do nothing
Usually i'll create a simple DoNotDestroy manager that will instantiate all the GO's i want preserved between scenes at runtime Awake(). Basically just do a quick search to see if the audio player exists already, if not, instantiate. Doing it this way should ensure you only have a single instance