Phase III -Progress report — options menu for volume control

The first iteration of the game is now complete and available for play at itchio. I have remade the HUD and added in some more audio. I have also added in an option menu to adjust the audio volume. I will discuss how below.

How to expose parameters in the audio mixer

First open your audio mixer and select the audio group you wish to expose the parameter of.

Next in the inspector right click on the volume settings and select expose. You will then be able to name the parameter in the audiomixer.

How to set up and use the slider to adjust your volume levels

Next we want to create a function with a float parameter that we can use a slider to adjust. I have created a new script called SliderAudioAdjuster. There are a few ways to access the audio mixer but the quickest and easiest is just to serialize the variable and assign it in the inspector. Dont forget to access the UnityEngine.Audio library.

You can access the mixer from an audio source if one if attached to the game object

How to set up the slider

We now need to add and set up our slider. Right click on your canvas and select UI > slider, to add a new slider.

We now need to adjust the min and max values. -80 is completely silent so we will use that as the min and we can set the max to 20.

We can add our function to our slider Onvalue changed event, ensuring to use the dynamic float option.

Next we test out our function.

Thats all for now.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Luke Duckett

Luke Duckett


Unity developer with a love of learning all things programming.