Home

Awesome

Omiya Games - Audio

openupm Audio documentation Ko-fi Badge License Badge

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:

Project Settings

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:

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:

Sound Effect Fields

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:

Create Sound Effect

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:

Create Looping Music 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:)

Looping Music Unity inspector

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.

  1. First, install the package via OpenUPM's command line tool, which handles installing this package and its many, many dependencies:

    1. 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
      
    2. Then, to install this package, just run the following command at the root of your Unity project:
      openupm add com.omiyagames.audio
      
  2. Open Unity.

  3. One of this package's dependency is Unity's Addressables, which needs setup:

    1. Select Window -> Asset Managerment -> Addressables -> Groups from the file menu bar.

      Addressables Groups context menu

    2. A pop-up with a single button will appear. Click Create Addressables Settings.

      Addressables Groups pop-up

    3. After some new assets are created in the project, close the pop-up window. Addressables are now setup.

  4. Another dependency that needs setup is Omiya Games' Saves package:

    1. Select Edit -> Project Settings... from the file menu bar.

      Project Settings context menu

    2. On the left sidebar, select Omiya Games -> Saves.

      Saves project settings

    3. Click on Create..., and save the new package settings file to any location within the project's Assets folder

      Save file pop-up

    4. Saves are now setup.

  5. Select Window -> Package Manager... from the file menu bar to open the package manager dock.

    Package Manager context menu

  6. Import this package's Custom Settings sample.

    Package Manager menu

  7. Move all the imported files to a folder more accessible location. You will likely be editing these files during development.

  8. Select Edit -> Project Settings... from the file menu bar to open project settings dock again.

  9. On the left sidebar, select Omiya Games -> Audio.

  10. Drag-and-drop the imported settings file, Audio Settings - Custom, into the Active Settings field.

    Audio project settings - Empty

  11. With the window content drastically changed, scroll to the bottom of the settings window, and click the Add Savers To Saves Settings button.

    Audio project settings - Filled

  12. (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.

    Saver files

  13. Select File -> Save Project to save all the above settings.

    Save Project

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