O'Reilly logo

Unity Game Development Scripting by Kyle D'Aoust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making audio configurations

For audio configurations, we'll set the volumes for background music, sound effects, and the atmospheric sounds. We will also be setting the speaker mode for the audio output. Let's start off by creating a new C# script and naming it Audio_Config.

Setting the values

The first function that we'll be creating will be used to set the default values for our configurations. Add this function to the script:

public void SetDefaults()
{
  SetBG(1.00f);
  SetSFX(0.80f);
  SetAtm(0.60f);
  SetAudioType("Stereo");
}

In this function, we call the functions that we'll be creating next to set the default values. For the first three functions, we set the volumes for various values. The last function sets the speaker mode to a stereo default. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required