Components

USound is a code-based audio manager. You only really need one component, which can be created from GameObject > USound > USound Setup.

USound extends the functionality of an Audio Source, which is known as a Sound Source.

SoundSourceSetupData

Most properties of the setup are of the SoundSourceSetupData type, which contains data for sound sources that will be created on start.

Properties

Sound Source Name

The name of the sound source (must be unique).

Mixer Group

The mixer group that the sound source should subscribe to.

Audio Clip

The clip that will be set immediately.

Volume

The start volume of the audio source (0 - 1).

Pitch

The pitch of the audio source (-3 - 3).

Spatial Blend

The spatial blend of the audio source (0 - 1).

Loop

If the audio source should be looping.

Play On Awake

If the audio source should play on awake.

USound Setup

This component is required to get USound to work, as it will setup the system. Only one is required in a scene.

Properties

The properties will be automatically populated when you add the USound Setup component.

Master Mixer Group

This is the master mixer group that all audio sources will subscribe to.

Default BGM Source Data

USound creates a default sound source for background music on start. This property sets some of the data for it.

Default One Shot Source Data

USound creates a default sound source for one-shot audio clips (usually for UI sounds) on start. This property sets some of the data for it.

Custom Sound Source Datas

A list of custom sound source data that will be created on start. You can create sound sources your game will use by adding them to this data list.

Main Folder

The main folder that your audio clips are in. The main folder should be inside a folder called Resources. This will make your audio clips findable through code. The main folder will act as a starting point when searching for audio clips. For example, if your audio clips are in the path Resources/Sounds, in the Main Folder property, you should write Sounds.

If your sounds are in subfolders inside the main folder, the extra path will need to be specified when getting an audio clip.

In the image above, you can see that the audio clips are inside a folder called TestSounds, which is inside a folder called Sounds, which is inside the Resources folder. In this example, we will use the Sounds folder as the main folder. So, when we want to find the audio clip named Click, we can do so with its short path, which is TestSounds/Click.

If the click audio clip was inside the Sounds folder instead, the short path would just be its name, which is Click.

Last updated