PlayerPrefs not saving slider data

Im trying to save my two sliders values to the playerprefs. It works until I end play mode and start again. Then its back to the default values. If I quit my game and go to the options menu while still in play mode it doesnt work then either. Is there something Im missing. Im very new to PlayerPrefs.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Options : MonoBehaviour {

	public Slider scoreSlider;
	public Slider livesSlider;

	public Text scoreSliderText;
	public Text livesSliderText;


	void Start()
	{
		PlayerPrefs.GetFloat("OptionScore");
		PlayerPrefs.GetFloat("OptionLives");
	}

	void Update()
	{
		PlayerPrefs.SetFloat("OptionScore", scoreSlider.value);
		PlayerPrefs.SetFloat("OptionLives", livesSlider.value);

		scoreSliderText.text = "" + PlayerPrefs.GetFloat("OptionScore");
		livesSliderText.text = "" + PlayerPrefs.GetFloat("OptionLives");
		scoreSlider.value = PlayerPrefs.GetFloat("OptionScore");
		livesSlider.value = PlayerPrefs.GetFloat("OptionLives");

		PlayerPrefs.Save();



	}
}

You’re saving the slider.value on every Update, when you run the game the slider is at the default position and the first Update saves that position, overwriting the one you saved before.

I see you’re getting those values on the Start method, I guess it’s to initialize the sliders to the values stored in PlayerPrefs, but you’re just getting the values, you’re not doing anything with them.

Try with this Start method:

void Start()
{
    scoreSlider.value = PlayerPrefs.GetFloat("OptionScore");
    livesSlider.value = PlayerPrefs.GetFloat("OptionLives");
}

Also, storing the values on EVERY Update looks like a bad idea (a waste of resources and may be the source of bugs), look at the onValueChanged property of the slider, you can even set it up in the Inspector.

You should’t use PlayerPrefs.Save in Update! By the Way, i think the problem is in Start():

void Start()
     {
         scoreSlider.value = PlayerPrefs.GetFloat("OptionScore");
         livesSlider.value = PlayerPrefs.GetFloat("OptionLives");
     }

Something I’ve noticed (unity 4.7.2)
Is that by the time you whant to save slider values to player prefs you’ve to do it individually rather than in bulk, this way

	public void ChaseCamDist_Save(){
		distance = DistanceSlicer.value;
		Debug.Log ("ChaseCamDist" + PlayerPrefs.GetFloat("ChaseCamDist"));
		PlayerPrefs.SetFloat ("ChaseCamDist", distance);
	}

	public void ChaseCamHeight_Save(){
		height = HeightSlider.value;
		Debug.Log ("ChaseCamHeight" + PlayerPrefs.GetFloat("ChaseCamHeight"));
		PlayerPrefs.SetFloat ("ChaseCamHeight",height);
	}

I was saving this two sliders with a single func and allways the second one failed and got the devault value instead. This happened me in teh past too.