Uncategorised

Don’t Destroy

One song. Three scenes. By default, the song will start from the beginning in every scene (as a new scene destroys all the objects from the previous one). Sticking to that would ruin the experience I was working on and wouldn’t have much sense in a MV. 

Luckily, Unity has a decent Documentation website where the solution was found. One of my course colleagues suggested that, too.  

Don’t destroy on load or DontDestroyOnLoad actually, is the way to have music played continuously. Empty game object created and renamed to “Background Music”. Next audio file assigned to the object and tagged as “Music”. After that there was time to generate a simple C# script – the one from the website linked above. The script had to be added to the Background Music object and et voilĂ , the tune plays as it should, without re-starting in a new scene.  

It was actually a bit more complicated as at some point I had tunes overlapping due to having audio files in my scenes already. I removed them and followed the Unity steps once again and this time the sound in my MV works perfectly fine. 

Leave a Reply

Your email address will not be published. Required fields are marked *