[Unity/Playmaker] How to Make a VR Shooting Game with BGM and SE Settings

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

  1. Advanced preparation
  2. Gun Controller Settings
  3. Setting up the bullets
  4. How to generate enemy characters
  5. Enemy Character Settings
  6. BGM and SE Settings
  7. 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

BGM Settings

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.

Play Musicステートを作成

Create a Play BGM state

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.

Audio Sourceの設定

Audio Source Settings

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.

EnemyプレハブのAudio Source設定

Audio Source configuration in Enemy pre-fab.

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.

DeadステートにAudio Playアクションを追加

Added Audio Play action to the Dead state.

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.

gunController_RのAudio Source設定

Audio Source setting of gunController_R

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.

Spawning BulletステートにAudio Playアクションを追加

Added Audio Play action to the Spawning Bullet state.

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.

Sample Scene

You can try out the sample game in the STYLY GALLERY.