Audio - vr4vet/Blue-Sector GitHub Wiki

AudioAoeTrigger

This prefab is for playing sound after entering a specified area. This is used for playing sound corresponding to the signboards in the FishFeed scene.

Usage

  1. Place the prefab where you want the area and sound source.
  2. Modify the box collider to decide where to trigger the audio.
  3. Drag the preferred audio file in the AudioClip field of the Audio Source component.

The prefab should now play the chosen audio file when entering the box collider.

Scripts

PlayAudio

The PlayAudio script is used in the AudioAoeTrigger prefab and plays the Audio Source component that is on the same object. The sound will only start playing again when the clip is done and the player has triggered the box collider again.

TurnOnOffAudio

An optional script that turns on and off sound to all the Audio Source components and PlayAudio scripts that are children of the game object to this script.