Sorting Best time

Ok ive been looking at my code for so long that i cant see whats wrong with it so could i have some help sorting the time atm it dosent sort it properly

edit: what i am doing is timing the player to complete a level the time is taken and sorted then the player can start again it resets time and start counting again and so on

using UnityEngine;
using System.Collections;
using System.IO;
using System;
public class Score : MonoBehaviour {
	
	public int Time;
	public int BestTime;
	public int SecondBestTime;
	public int ThirdBestTime;
	
	
	void Start () 
	{	
		Time = PlayerPrefs.GetInt("Time");
		BestTime = PlayerPrefs.GetInt("Best Time");
		SecondBestTime = PlayerPrefs.GetInt ("Second Best Time");
		ThirdBestTime = PlayerPrefs.GetInt ("Third Best Time");
		InvokeRepeating("Points", 2, 0.3F);
	}
	
	
	// Update is called once per frame
	void Points () 
	{
		Time += 1;
		PlayerPrefs.SetInt("Time",Time);

		if (Time >= BestTime || Time < BestTime)
		{
			// Set the highscore to our current score
			BestTime = Time;
			// savign highscore
			PlayerPrefs.SetInt("Best Time", BestTime);
		}
		else 
		{
			if(Time >= SecondBestTime && Time > BestTime && Time > ThirdBestTime)
			{
				SecondBestTime = Time;
				PlayerPrefs.SetInt("Second Best Time", SecondBestTime);
			}
		}
		
		if (Time >= ThirdBestTime && Time < SecondBestTime && Time < BestTime )
		{
			// Set the highscore to our current score
			ThirdBestTime = Time;
			// savign highscore
			PlayerPrefs.SetInt("Third Best Time", ThirdBestTime);
		}
		
		
		
	}

	void OnGUI()
	{
		Time = PlayerPrefs.GetInt("Time");
		GUI.Box(new Rect(200,10,100,30),"Time:"+Time.ToString());

		
			
	

			
			
		
	}
}

i dont really understand what you are trying to do but you could just make sometihng like this:

  1. add your points in a ‘List’;
  2. call list.Sort();
  3. you are done! list[0] is the best time list[1] is the second best time, etc…

Try this:

if (Time >= BestTime)
{
	// Set the highscore to our current score
	BestTime = Time;
	// savign highscore
	PlayerPrefs.SetInt("Best Time", BestTime);
}
else
{	
	if(Time >= SecondBestTime && Time < BestTime)
	{
		SecondBestTime = Time;
		PlayerPrefs.SetInt("Second Best Time", SecondBestTime);
	}
	else if (Time >= ThirdBestTime && Time < SecondBestTime)
	{
		// Set the highscore to our current score
		ThirdBestTime = Time;
		// savign highscore
		PlayerPrefs.SetInt("Third Best Time", ThirdBestTime);
	}

}