Android - add highscore system, save highscore? DESPERATE

I have a simple script that adds 1 point to a GUI counter whenever the screen is touched, which is perfect for my game, but I want the highscore to be saved and displayed.

I am unable to understand or find anything at my noob level about this.

When my player dies, the level is reloaded, so have that in mind.

All I can do is add your name to the credits and see you as a hero, lol.

Please write this to my script, I am begging from the depths of my soul.

var score : int;
 
 
 
function Update () {
 
        if(Input.GetKeyDown("mouse 0")){        //Player kills the dragon or spaceship or whatever
 
                score += 1; //increase the score
 
        }
 
 
 
        guiText.text = score + " "; //Display the score to the user!
 
 
 
        }

For saving/loading highscores, try this:

I do not understand that!!! Ofc i checked it out

You can save score by (for example when you get game over)

then when you want to load score (for example when scene is loaded), use this and display it on GUIText:

please add them to my script so I know from know on because I get slapped with errors

What kind of errors?

Here is some info about PlayerPrefs also:
http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/persistence-data-saving-loading

I get errors because I am new to scripting and I don’t understand how to adapt any info I find to my specific script…

Then should check these, it will help alot!

or make some of those tutorial games,

1 Like