var i :int;
var newScore : int;
var oldScore : int;
function Update (){
newScore = Counts.floor;
PlayerPrefs.SetInt(“score”,Counts.floor);
for(i =0;i<10;i++){
if(PlayerPrefs.HasKey(i+“score”)){
if(PlayerPrefs.GetInt(i+“score”)<newScore){
oldScore = PlayerPrefs.GetInt(i+“score”);
oldName = PlayerPrefs.GetString(i+“HScoreName”);
PlayerPrefs.SetInt(i+“score”,newScore);
newScore = oldScore;
newName = oldName;
}
}else{
PlayerPrefs.SetInt(i+“score”,newScore);
PlayerPrefs.SetString(i+“score”,newName);
newScore = 0;
}
}
}
function OnGUI (){
GUI.Label(Rect(375, 10, 150, 50), "NAME: "+ PlayerPrefs.GetInt(1+"score"));
GUI.Label(Rect(375, 30, 150, 50), "NAME: "+ PlayerPrefs.GetInt(2+"score"));
}
My game like Tower Bloxx
This script have save high scores only,
but not save second high score,
Please help me . Where are wrong.