magnifying-glass-musicAudio System Overview

This template features a customizable audio solution that's handy for many scenarios.

Settings

Every audio is presented as a Scriptable file with settings inside:

  • To make mixing easier, all audio files are categorized into 3 groups: Gameplay, Music, and UI

  • Audio Data can be of two types: Single and Multi.

Single audio is self-descriptive, while Multi is used when there's a need for several different sounds for one action.

circle-check
  • Cooldown is used for highly repeated sounds, for example, the gem pick-up sound, when it's played multiple times in a row in a fast sequence. Setting a short cooldown will smooth this out.

  • Pitch Curve is an option to progressively change the pitch of a repeated sound. You can set up your custom curve and cooldown options there as well.

  • Vibrate on Play will give a light, short vibration when this sound is being played.

Below the settings, you can assign your audio file, and for each one, set volume and Pitch settings. These settings can be set as a Constant value or as a Random Between Two.

Usage

These audio data files are used everywhere throughout the template, for example, in the Heal drop prefab:

Audio Data can be assigned in any slot that requires this type of file.

In code, to play Audio Data, use:

PlayAudio() method returns an AudioSource Component or null if AudioManager rejects playing the sound because of cooldown.

Template uses Audio Mixer located in Assets/Common/Scriptables/Audio. It has two snapshots:

  • Normal - All sounds are at the full strength

  • Paused - UI sounds are at the full strength, Gameplay sounds are muted and the music has lower volume.

There are two audio datas that are directly assigned inside AudioManager:

  • Button Click.

  • Main Menu music.

You can play them from Audio Manager directly:

You can modify them inside Audio Manager Component, that located in Main Menu scene under Game Controller GameObject.

Last updated