Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

I would personally just not have the music cut out, fade out or pause ever. The way I did it in my game, is to make a separate empty object in the first scene you load, usually the menu. Then put an AudioManager class (or whatever you want to name it) on that object and add DontDestroyOnLoad(this); in the Awake() function. This way the class is never destroyed between scenes and can just keep playing music. Then add an AudioSource component on there and just cycle randomly through an array of AudioClip elements, which you fill with all your music tracks. Here's the code for that if you're interested: https://pastebin.com/HM8QEfV4

But, of course, that's my way of doing things and the way I prefer. Ultimately it's up to you what effect you want, but maybe this gives you some ideas ;). I only learned of using DontDestroyOnLoad recently and it's been a gamechanger for me.

Oh wow, Thank you so much! Yeah I've heard of DontDestroyOnLoad() but never tried it yet, so this is what it can be use for, Interesting! Actually I might apply this for the scene between the main menu and Blade customisation.  The the code is really clear, and yeah I can see it being used, especially during the arena I could cycle thru a variety of music. :D 

Once again thank you so much! Appreciate it a lot!

Yea, exactly! I also use it to "transport" data between scenes without having to save it using PlayerPrefs or such. It's a very useful tool and one I should've looked at sooner in hindsight. Glad you can make use of the code. Good luck with it and your further development!!