O'Reilly logo

Mastering Unity 2D Game Development - Second Edition by Simon Jackson, Ashley Godbold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required