Box Bot — Unity Tutorial 5
Hello, So finally we are here at the end of this Simple Platformer Tutorial series. In this tutorial, we will learn how to add music effects and background sounds to our game.
By this end of the tutorial, we will be able to make our simple platformer with all the basic needs.
1. Open up the Unity Editor and import the Box Bot Music Assets folder. Now create an empty Game Object and reset the position. Also, rename the Game Object to Audio Manager. Now this will be the holder for all of our audio assets that we are going to use in this game.
2. Now create a child empty Game Object and rename the Game Object to the Background Music. Now head over to the Add component and add Audio Source to the Background Game Object. Also, search for the background music, select any one and drop it in the Audio Clip present over the Audio Source component.
3. Now do the same for other SFX as well. Create an empty Game Object, rename it to the desired sound you want and add the sound to the audio clip present over the audio source component.
4. Now open the Movement script. Declare the variables to give reference to the desired components.
5. Add the audiosourcename.Play() to play the specified sound whenever require. We will add jumpsound.Play() when the player jumps, gemsound.Play() when the player collects a gem, keysound.Play() when the player collects a key, winsound.Play() when the player win and deathsound.play() when the player dies.
And Yes!! We have Finally completed the Simple Platformer Tutorial Series. So far we have learned how to make our Player move with good controls, we have known how to detect the ground and make our Player jump only when our player is standing on the ground, also we made our player jump twice in the air, then we learned how to make our player jump one way over a platform and how to make a super dash vertically, Moving forward we got to know how to collect the collectibles like gem and key and lastly we learned how to add music to our game.
So this tutorial could be the beginning point for all the beginners out there who actually want to start their journey and are waiting to figure out their path in this vast ocean of Game Development.
Project Files — Box Bot Tutorial Project Files
Graphics Assets — Box Bot Graphics Assets