- Home /
This question was
closed Apr 10, 2013 at 07:14 AM by
Fattie for the following reason:
Duplicate Question
Question by
yvyv1000 · Apr 10, 2013 at 06:24 AM ·
scorescoreboard
scoreboard
i have a score script but i dont know how i can make that the player can see his score
script:
var Score : int = 0;
function ObjectCaught(enemy) {
Destroy(enemy);
Score++;
}
Comment
Best Answer
Answer by fafase · Apr 10, 2013 at 06:36 AM
var scoreRect:Rect;
function Start(){
scoreRect = new Rect(Screen.width/4*3,Screen.height/4, Screen.width/20, Screen.height/20);
}
function OnGUI(){
GUI.Box(scoreRect,Score.ToString());
}
What it does is create a box in the top right corner. Then it displays your score in it. Add this on your existing script.
Note the Rect, the values are not hardcoded, meaning you are using the screen dimensions so that if you use on a tiny screen, the box is tiny too.
Follow this Question
Related Questions
Scoring System 3 Answers
Scoreboard will not update 1 Answer
How to create a HighScore using playerprefs based on passed time? 1 Answer
Scoreboard Setup 2 Answers