- Home /
Best Answer
Answer by Piflik · Sep 08, 2012 at 06:00 PM
You need a score variable (probably static), that you increase every time you kill an enemy and then display it on the GUI.
Add this to your enemies:
function OnDestroy() {
score.score += 10;
}
And then this would be score.js:
static var score : int = 0;
function OnGUI() {
GUI.Label(Rect(X, Y, width, height), "Score:" + score);
}
Your answer
Follow this Question
Related Questions
Display var on gui not working... 2 Answers
Script Not counting enemy kills. 1 Answer
How to change an int in a different class (for score) 1 Answer
Score and gui help 1 Answer
Showing score with GUI 2 Answers