How can i set audio mixer groups volume to be used with ui slider when 0 is lower and 80 louder ?

I’m not yet understanding the audio part to the end.
But what I did so far. I created a new Audio Mixer.
I created two new groups so now i have 3 groups: Master volume , Music volume, Effects volume.

You can see in the screenshot when the game is running when i move the slider in the game view window to the left just near the left side it’s like 0 but if i will keep move it to the fdar end left side it will get louder again. To the right it’s getting louder.

Same for the effects slider volume.

You can see also in the audio mixer on the second screenshot that the 0 value of the volume is near the top And -80 is at the bottom.

What i want to do is two things:

  1. Making when the game is running if i move the slider to the left make it less louder the volume where 0(mute no sound) on the left side and most louder volume to the right end side. Same for both sliders.

  2. To add something that will show me when the game is running each slider current value so when i’m changing the sliders left or right i will see the current value of the volume.

The main idea is to make that each slider most left side is mute not sound most right side volume is louder/higher and to display some ui for each slider volume current value. And make it smooth volume change left/right.

In general the volumes are working but not the way i want it by the values.

And this is the script i’m using for each slider in the On Value Changed in the inspector i’m calling each slider to it’s own method: SetMusicVolume() and SetEffectsVolume()

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine.Audio;


//[System.Serializable]


public class AudioManager : MonoBehaviour
{
    public Slider musicVolume;
    public Slider effectsVolume;
    public AudioMixer audioMixer;

    public void SetMusicVolume()
    {
        audioMixer.SetFloat("musicVol", Mathf.Log10(musicVolume.value) * 20);
    }

    public void SetEffectsVolume()
    {
        audioMixer.SetFloat("effectsVol", Mathf.Log10(effectsVolume.value) * 20);
    }
}

In the slider component in the inspector, set min value to -80, and max value to 0. You could set it to something higher than 0 (20), but its not good to boost the gain of audio. Its always better to use subtractive methods while mixing, i.e if something is not loud enough, turn everything else down. (This just coming from my music back ground). So you don’t want your user to push the gain above 0.

In terms of viewing the current value, you will need to make a script to handle that.
Create a Text object in the scene.

So i’d change your script to something like:

	[Header("Music")]
	public Slider musicVolume;
	public Text musicText;

	[Header("Effects")]
	public Slider effectsVolume;
	public Text effectsText;

	[Header("Mixer")]
	public AudioMixer audioMixer;

	void Start()
	{
		musicVolume.onValueChanged.AddListener(SetMusicVolume);
		effectsVolume.onValueChanged.AddListener(SetEffectsVolume);
	}

	public void SetMusicVolume(float value)
	{
		musicText.text = ((int)value).ToString();
		audioMixer.SetFloat("musicVol", value);
	}

	public void SetEffectsVolume(float value)
	{
		effectsText.text = ((int)value).ToString();
		audioMixer.SetFloat("effectsVol", value);
	}

But this does mean that the text value will show numbers ranging from -80 to 0. which might be confusing for some users, so you will need to some converting of the numbers to make it show something from like 0-1 or 0-100, its up to you what you want your user to see.