im trying to make it so my volume slider will save from the main menu to the in game pause menu and also save it after you close the game and reopen it, this is the code
using UnityEngine;
using UnityEngine.Audio;
public class SetVolume : MonoBehaviour
{
public AudioMixer mixer;
public float mixerVolume;
public void SetLevel(float sliderValue)
{
PlayerPrefs.GetFloat("VolumeData");
mixerVolume = Mathf.Log10(sliderValue) * 20;
mixer.SetFloat("volume", mixerVolume);
PlayerPrefs.SetFloat("VolumeData", mixerVolume);
}
}
the inspector looks like this
when I move the slider the mixer volume doesn’t change, but it still does change the audio volume