ScoreCount

Hi,

I’ve created a score counter using:

function OnGUI () {
	GUI.Box( Rect(Screen.width - 100, Screen.height - 20, 100, 20), "Counter is: " + (score));
}

but now I want to display the total score on the Game Over screen.

How do you print the total score??

what you have seems like it would work fine, just change it so its like:

function OnGUI () {
	GUI.Box( Rect(Screen.width - 100, Screen.height - 20, 100, 20), "Total Score: " + (score));
}

and then you could change some of the values

how is it possible to reference back to the score in the game and display this in my new Game Over scene??

oh, i didnt realize that was a new scene. use this:

var score : int;

function Update () {
	PlayerPrefs.SetInt("Score", score);
}

in your counting script thing. and then use:

function OnGUI () {
	GUI.Box( Rect(Screen.width - 100, Screen.height - 20, 100, 20), "Total Score: " + (PlayerPrefs.GetInt("Score")));
}

jm studios - you are a unity god… thankyou

your welcome