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! Code (CSharp): 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(); } }
EDIT to this old thread I posted... see here for more on dynamic Slider values: https://forum.unity.com/threads/cant-return-a-value-for-drop-down-list.1171442/#post-7504738 ---------------------- my original post: This is kind of an annoying tricky part about Sliders. The callback shouldn't take a float unless you want a constant float. Instead you want it to take a Slider, from which you pry out the .value field. It is discussed here: https://answers.unity.com/questions/1069374/slider-onvaluechanged-sending-only-0-or-other-defi.html I just tested it here with this code: Code (csharp): using UnityEngine; using UnityEngine.UI; public class glug : MonoBehaviour { public void SetVolume( Slider s) { Debug.Log( "fnord:" + s.value); } } and my slider setup event looked like: Don't forget to drag the slider instance itself into argument field.