Gamespace: Inputting Audio
I inputted the background by attaching the audio source component to my player.
I checked the loop and play on awake option so that the background music would constantly play.
Audio Source for the background music |
The audio source for the 'Rain Loop' sound was attached as a component to the rain cloud enemies.
The Loop and Play on awake options are checked as I want this sound to be playing continuously.
I changed the values for specific settings/effects and changed the lines on the graph. Therefore when the player was near the rain cloud enemy, the volume would be quite high (shown by the red line on the graph) and when further away the volume would decrease.
Audio Source for the rain loop |
I added this code to the PickUp script so that when the player collides with a gameObject with the tag 'Player'. The audio source would be received and the ball collection sound would be played.
Code snippet from PickUp script |
This was the audio source component for the 'Ball Collection Sound' which was placed in every item's inspector. The loop and play on awake were unchecked so that the sound only played when triggered.
Audio source for the Ball Collection Sound |
Comments