Omiya Games - Audio
Audio is an auditory tools package by Omiya Games to provide a number of helper scripts and assets useful for game development. As of this writing, this package provides the following tools:
Audio Manager
The AudioManager
is a script that interfaces with the project's Audio Mixer. Its settings are visible in the Project Settings window, like so:
As a singleton class, audio manager allows the developer to adjust the volume and pitch for one of 5 potential audio groups in an Audio Mixer from nearly anywhere:
- Main - Adjusting the volume and pitch of this group will affect all audio.
- Music - Affects music playing both in the background, and within the game world (e.g. a radio.)
- Voices - Affects any spoken lines, grunts, and other human-like voices.
- Ambience - Affects any ambient sound effects, usually playing in the background.
- Sound Effects - Affects any other sound effects not covered by above groups.
For more details, check out the dedicated manual page here.
Sound Effect
The SoundEffect
script interfaces with an audio source to perform common tricks to create more varied sound effects. It is designed to add features to Unity's built-in AudioSource
component:
Also, sound effect can be directly added into the hierarchy via the Create...
menu, both in the hierarchy window, and right-click context menu. This method has the added benefit of setting the audio source's output to the mixer group set in the Sound Effects settings under Audio Manager's Project Settings:
For more details, check out the dedicated manual page here.
Looping Music
The SingleLoopingMusic
asset allows defining a looping music with some extra goodies. It's created in the Project dialog through the usual "Create" context menu:
The asset also allows adding an optional intro stinger that's played before the loop starts, and how long to delay the loop while the intro is playing (by default, set to how long the stinger is:)
Note that SingleLoopingMusic
is an instance of BackgroundAudio
. To create other similar assets that can be played on AudioManager
, consider extending BackgroundAudio
and BackgroundAudio.Player
.
For more details, check out the dedicated manual page here.
Install
This (we swear, one-time!) setup is a bit of a doozy.
- First, install the package via OpenUPM's command line tool, which handles installing this package and its many, many dependencies:
- If you haven't already installed OpenUPM, you can do so through Node.js's
npm
(obviously have Node.js installed in your system first):npm install -g openupm-cli
- Then, to install this package, just run the following command at the root of your Unity project:
openupm add com.omiyagames.audio
- If you haven't already installed OpenUPM, you can do so through Node.js's
- Open Unity.
One of this package's dependency is Unity's
Addressables
, which needs setup:Select
Window -> Asset Managerment -> Addressables -> Groups
from the file menu bar.A pop-up with a single button will appear. Click
Create Addressables Settings
.- After some new assets are created in the project, close the pop-up window. Addressables are now setup.
Another dependency that needs setup is Omiya Games'
Saves
package:Select
Edit -> Project Settings...
from the file menu bar.On the left sidebar, select
Omiya Games -> Saves
.Click on
Create...
, and save the new package settings file to any location within the project'sAssets
folder- Saves are now setup.
Select
Window -> Package Manager...
from the file menu bar to open the package manager dock.Import this package's
Custom Settings
sample.- Move all the imported files to a folder more accessible location. You will likely be editing these files during development.
- Select
Edit -> Project Settings...
from the file menu bar to open project settings dock again. - On the left sidebar, select
Omiya Games -> Audio
. Drag-and-drop the imported settings file,
Audio Settings - Custom
, into theActive Settings
field.With the window content drastically changed, scroll to the bottom of the settings window, and click the
Add Savers To Saves Settings
button.(Optional) In this sample, there are a lot of assets under the
Savers
folder. These files contains the default volume and mute settings for each audio category. It's recommended to edit these files' default values to your liking.Select
File -> Save Project
to save all the above settings.
Resources
LICENSE
Overall package is licensed under MIT, unless otherwise noted in the 3rd party licenses file and/or source code.
Copyright (c) 2019-2022 Omiya Games