“How to Build a VR Shooting Game” shows you how to build a VR shooting game using Unity and Playmaker, upload it to STYLY, and publish it.
This article shows you how to set the BGM and SE during the game.
- Advanced preparation
- Gun Controller Settings
- Setting up the bullets
- How to generate enemy characters
- Enemy Character Settings
- BGM and SE Settings
- How to upload to STYLY
Part.1-7 continues, so let’s read them through and make it to the end!
In the previous article, we set up the enemy “girl”.
Setting the music controller
To add BGM to your game, create a new empty game object called “musicController” first and then get it started as state of “Play Music” in its FSM.
In the Inspector tab for the MusicController object, click on the Add Component and add an “Audio Source” component to make the controller actually play BGM.
Drag the Boss Fight track from the myAudio folder into the “Audio Clip” field and check the “Play On Awake” and “Loop” boxes as well.
Now, once the game starts, BGM starts and it continuously plays until the game ends.
How to Set Up SE
Now, add sound effects to the enemy and bullets.
Click the Enemy pre-fab and add the Audio Source component from the Inspector window.
Press the round button to the right of the AudioClip field to select an audio clip and select the “mai_free_08_damage” audio track.
Be sure to uncheck the Play On Awake box as well.
Now go to Enemy’s FSM and click on Dead State.
Add an “Audio Play” action right after the Set Animator Bool action and set it as shown in the image.
Now add a sound effect to the gun.
Add the “Audio Source” component to gunController_R in the same way as musicController and Enemy, and drag the “shot_hand_gun” audio clip into the AudioClip field.
Also, uncheck Play On Awake and set it to False.
Finally, go to the Spawning Bullet state in the FSM of gunController_R, add the Audio Play action, and configure it as shown in the figure below.
Now you can play BGM/Sounds in the game.
The next Part7 will be the last of the tutorials.
Finally, we’ll show you how to add stages to complete your game and upload your game to STYLY.
You can try out the sample game in the STYLY GALLERY.