How to save my sound effects changes with a slider?

Hello! I want to know how to save my sound effects either if they are click sounds or player collision whatever. First of all, I have an options scene where I have a slider for changing volume of ui sounds and I want to know how to save when clicking save button in options those settings?

Define “save”; if you have already implemented slider changing values you might want to just use PlayerPrefs SetFloat and Save. And if you didn’t, attach slider onValueChanged event in the inspector, to the method changing the volume in your script.

    public void OnSliderChangeVolume(float number)
    {
        if (text.text != number.ToString() + " %")
        {
            text.text = number.ToString() + " %";
        }
        SaveObject.soundvolume = (int)(number);
        AudioListener.volume = number / 100;
    }

This is how I did it to change the volume of all sounds^
Where should you change volume of different sound groups? I d recommend setting up Audio Mixer Groups. Can’t elaborate more since I never used it yet. Oh and it won’t work if you making WebGL game.

This video should help you.

then, change the void Awake to void Update

    void Update()
    {
        foreach(Sound s in sounds)
        {
            s.source = gameObject.AddComponent<AudioSource>();

            s.source.clip = s.clip;
            s.source.pitch = s.pitch;
            s.source.volume = s.volume;
            s.source.loop = s.loop;
        }
    }

this will make it automatically change when the sound is affected.