- Home /
Question by
Tyler 2 · Dec 22, 2010 at 07:49 AM ·
playerprefs
Combining two scripts...
Hello. I am trying to set up the high score table for my game. I have read that using the ArrayPrefs script from the wiki works well for storing multiple integers for the same playerPref. The problem is, I dont quite understand how to use it with my existing playerpref script. Can anyone help me combine my script with it? Thanks
Here is my score script (it works by reading the combination of options for the game and then setting a unique integer for it, so that each specific combination of options has its own high score).
function Update ()
{
var Arcade : String = System.String.Format("{0}{1}{2}_score", Arcade.ModeInt, Arcade.DifficultyInt, Arcade.CharacterInt);
PlayerPrefs.SetInt(Arcade, Stats.Score);
}
And here is the ArrayPrefs script
var myScores = new int[10];
for (i = 0; i < myScores.Length; i++)
myScores[i] = i+1;
if (!PlayerPrefsX.SetIntArray("Scores", myScores))
print("Can't save scores");
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613092043im_/https://answers.unity.com/themes/thub/images/avi.jpg)