problem saving to playerprefs?

hey all, im trying to make a high score system and using the follwing script at the end of the game

   if(OverallTime > PlayerPrefs.GetInt("HighScore"))
    //			{
    //				PlayerPrefs.SetInt("HighScore", OverallTime);
    //			}

the problem is im getting this error:

Operator >' cannot be applied to operands of type string’ and `int’

now my overall score comes from the time in game, as shown below but im clueless how to make this work.

	public string OverallTime;


OverallTime = Time.timeSinceLevelLoad.ToString("0");

Looks like the variable OverallTime is a string. you cannot compare a string and an int;
Also, timeSinceLevelLoad is a float, you should really leave it as such otherwise your time will be truncated into whole seconds.

Instead you can just omit the variable completely and use:

if(Time.timeSinceLevelLoad > PlayerPrefs.GetInt("HighScore")){
    // new high score!
    PlayerPrefs.SetFloat("HighScore", Time.timeSinceLevelLoad;
    PlayerPrefs.Save();
}

OverallTime is a string and your trying to compare that with an int. So you need to convert OverallTime to an int and then you can compare.

if(int.Parse(OverallTime) > PlayerPrefs.GetInt("HighScore"))
{
    PlayerPrefs.SetInt("HighScore", OverallTime);
}