I have a slider that controls my volume. It was working fine until I imported the Unity Particle Pack off the Asset Store. The slider doesn’t update the mixer’s value, but does everything else. My code was unchanged and yes, I have assigned my audio mixer, functions, and all of that. I’m not sure what happened, please help!
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
public class OptionsMenu : MonoBehaviour {
public AudioMixer mixer;
public Slider slider;
public void SetVolume(float volume)
{
mixer.SetFloat("Volume", volume);
}
public void Start()
{
SetVolume(PlayerPrefs.GetFloat("Volume", 0));
slider.value = PlayerPrefs.GetFloat("Volume");
}
public void OnDisable()
{
float Volume = 0f;
mixer.GetFloat("Volume", out Volume);
PlayerPrefs.SetFloat("Volume", Volume);
PlayerPrefs.Save();
}
}