Let’s Set Up Sound Effects for the Player.
Now, let’s proceed to set up the sound effects, starting with the player. We will add the “Jump Sound,” “Bullet Firing Sound,” “Damage Taken Sound,” and “Defeated Sound” to their respective states.
Add Sound to the “Jump” State.
-
Switch the Scene tab to “player” and the Editor view to “Script.”
-
Select the “Jump” state.
-
In the Inspector, click “+ Add Execution Action.”
-
Select the “Play Sound” action.
-
Select the sound data “se_player_jump(se_player_jump.ogg)” and click “Add.”
- Try a test play. If configured correctly, you should hear a sound effect when jumping with the Z key.
Add “Play Sound” Action to “Ground Shot,” “Air Shot,” and “Movement Shot.”
Next, we will add shooting sounds. There are three shooting states, so let’s configure each one.
-
Select the “Ground Shot” state.
-
In the Inspector, select “+ Add Execution Action.”
-
Choose the execution action “Play Sound.”
-
Set the sound data to “se_player_shot(se_player_shot.ogg)” and click “Add.”
-
While you could repeat this process, execution actions can also be copied and pasted, so let’s try using copy/paste.
-
Right-click the added “Play Sound” action and select “Copy.”
-
Select the “Movement Shot” state.
-
Change the size of the Execution Action field in the Inspector from 1 to 2. This item sets the number of execution actions.
-
A “” item will appear; right-click it and select “Paste.”
-
If the “Play Sound” action is pasted as shown below, it is successful.
-
Select the “Air Shot” state and repeat steps 7 to 10 to copy/paste the “Play Sound” action.
-
Once completed, try a test. Fire a bullet with the X key while waiting, moving, or jumping, and confirm that the same sound plays.
Add “Play Sound” to the “Damage Taken” State.
Next, adding sound to the Damage Taken state. Since the procedure for adding “Play Sound” is the same, the explanation will be abbreviated.
- Add the “Play Sound” action and select the sound data “se_player_damage(se_player_damage.ogg).”
- Since a Wait action is included in the Damage Taken state, drag the three-line icon of the “Play Sound” action to move it before the Wait action.
- Perform a test play and check if the sound plays when hitting an enemy.
Add “Play Sound” to the “Defeated” State.
- Select the “Defeated” state and add the “Play Sound” action by selecting the sound data “se_player_down(se_player_down.ogg).”
- Perform a test play. If the sound plays when falling or when HP reaches 0, the player’s sound settings are OK.









