Phase III -Progress report — options menu for volume control

Luke Duckett
3 min readJun 5, 2021

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.

--

--

Luke Duckett

🎮 First Nations Unity Dev from Wonnarua country 🏞️ | From Player to Lifelong Learner: Crafting Games, Debugging Code, and Embracing New Technology