saving highscores

i’ve read many questions on this but can’t seem to get mine to work, i have this script to save my score:

function saveScore(){
		if(difficultyManager.difficulty == 1){
			PlayerPrefs.SetFloat("EasyScore", spawner. waveCounter);
		}
		if(difficultyManager.difficulty == 2){
			PlayerPrefs.SetFloat("MedScore", spawner.waveCounter);
		}
		if(difficultyManager.difficulty == 3){
			PlayerPrefs.SetFloat("HardScore", spawner.waveCounter);
		}
}

and this script to retrieve it:

var diff = 1;
var score = 0;

function Update () {
	if(diff == 1){
		score = PlayerPrefs.GetFloat("EasyScore");
	}
	if(diff == 2){
		score = PlayerPrefs.GetFloat("EasyScore");
	}
	if(diff == 2){
		score = PlayerPrefs.GetFloat("EasyScore");
	}
	GetComponent.<TextMesh>().text = ""+score;
} 

but it simply doesn’t work! also for when it does work, will it save and retrieve scores whilst in ther unity test play or does it only work on the build version, thanks in advance.

I hope your difficulty is set to 1, cuz that’s all you are retrieving! otherwise this will definitely work… if difficultyManager is set up like {easy,medium,hard} then easy is actually equal to zero, that MAY be the prob… Just make sure you are saving to/retrieving the SAME thing!

And yes, it will work in the editor as well as an actual build.