trying to do a playerprefs highscore system, but i think im missing something and cant figure out what it is.
var score : int = 150;
function Start()
{
if( score > PlayerPrefs.GetFloat(“Score1”) ){
PlayerPrefs.SetFloat( “Score5”, PlayerPrefs.GetFloat(“Score4”) );
PlayerPrefs.SetFloat( “Score4”, PlayerPrefs.GetFloat(“Score3”) );
PlayerPrefs.SetFloat( “Score3”, PlayerPrefs.GetFloat(“Score2”) );
PlayerPrefs.SetFloat( “Score2”, PlayerPrefs.GetFloat(“Score1”) );
PlayerPrefs.SetFloat(“Score1”, score);
}
else if( score > PlayerPrefs.GetFloat(“Score2”) ){
PlayerPrefs.SetFloat( “Score5”, PlayerPrefs.GetFloat(“Score4”) );
PlayerPrefs.SetFloat( “Score4”, PlayerPrefs.GetFloat(“Score3”) );
PlayerPrefs.SetFloat( “Score3”, PlayerPrefs.GetFloat(“Score2”) );
PlayerPrefs.SetFloat(“Score2”, score);
}
else if( score > PlayerPrefs.GetFloat(“Score3”) ){
PlayerPrefs.SetFloat( “Score5”, PlayerPrefs.GetFloat(“Score4”) );
PlayerPrefs.SetFloat( “Score4”, PlayerPrefs.GetFloat(“Score3”) );
PlayerPrefs.SetFloat(“Score3”, score);
}
else if( score > PlayerPrefs.GetFloat(“Score4”) ){
PlayerPrefs.SetFloat( “Score5”, PlayerPrefs.GetFloat(“Score4”) );
PlayerPrefs.SetFloat(“Score4”, score);
}
else if( score > PlayerPrefs.GetFloat(“Score5”) ){
PlayerPrefs.SetFloat(“Score5”, score);
}
highscore();
}
function highscore()
{
guiText.text = (PlayerPrefs.GetFloat(“score1”)).ToString ();
guiText.text = (PlayerPrefs.GetFloat(“score2”)).ToString ();
guiText.text = (PlayerPrefs.GetFloat(“score3”)).ToString ();
guiText.text = (PlayerPrefs.GetFloat(“score4”)).ToString ();
guiText.text = (PlayerPrefs.GetFloat(“score5”)).ToString ();
}