Adding background music

To begin, I grabbed the song Bit Shift by Kevin MacLeod over at incompetech.com. If you go to the site, select Get Started with Music and you can search by mood, genre, and other properties. You can also search for the name of the song to download the one I am using. I chose this song because it reminds me a lot of Phantasy Star on the Sega Master System, which is one of my all-time-favorite games. But I digress. Add whichever song you choose to the Assets/Audio/Music folder.

We are going to just have this one song play throughout all of our scenes. This means that we need to create an object that starts playing the music at our initial scene and then doesn't destroy when a new scene loads. Placing this object in a scene ...

Get Mastering Unity 2D Game Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.