how to save a android game

I am making a android game and i have a int variable that i want to be saved if the game is quit so when you start playing again you still have you’re highscoe. this is my code:

#pragma strict

static var highscores : int = 0;

function Start () {

} function Update () {

if(highscore.score > highscores){

highscores = highscore.score;

} guiText.text = highscores.ToString();


i want the variable: highscores, to be saved.

Yu can use the PlayerPrefs for that

You could add to your script:

    function OnDisable() {
        PlayerPrefs.SetInt("Highscore", highscores); //Save Highscore OnDisable 

    function OnEnable () {
	    highscores = PlayerPrefs.GetInt("Highscore",0); //Load Highscore OnEnable 

It works on all platform ,so far i could test it, at least at win/mac/iOS/Android.