I am not quite sure what you are trying to look for. The code executes as expected. Are you referring to SCORE and
DebugScore variable?
static var SCORE = 0;
var CustomGUI : GUISkin;
static var TopScore = [[COLOR="red"]300000[/COLOR], 5000, 10000, 50000, 100000, 200000];
//I am using a debug score to test it
var DebugScore = 0;
function Update () {
System.Array.Sort(TopScore);
}
function OnGUI () {
GUI.skin = CustomGUI;
[B][COLOR="red"] SCORE = -100;
DebugScore = -200;[/COLOR][/B]
TopScore[0] = DebugScore;
//Print out the score
GUI.Label (Rect (10, 10,10000, 10000), "Score: " + SCORE);
GUI.Label (Rect (10, 25,10000, 10000), "1: " + TopScore[5]);
GUI.Label (Rect (10, 40,10000, 10000), "2: " + TopScore[4]);
GUI.Label (Rect (10, 55,10000, 10000), "3: " + TopScore[3]);
GUI.Label (Rect (10, 70,10000, 10000), "4: " + TopScore[2]);
GUI.Label (Rect (10, 85,10000, 10000), "5: " + TopScore[1]);
GUI.Label (Rect (10, 100,10000, 10000), "Debug: " + TopScore[0]);
}
or do you want something like this?
static var SCORE = 0;
var CustomGUI : GUISkin;
static var TopScore = [[COLOR="red"]7000[/COLOR], 5000, 10000, 50000, 100000, 200000];
//I am using a debug score to test it
var DebugScore = 0;
function Update () {
System.Array.Sort(TopScore);
}
function OnGUI () {
GUI.skin = CustomGUI;
SCORE = -100;
[COLOR="red"] //TopScore[0] = DebugScore;
DebugScore = TopScore[0];[/COLOR]
//Print out the score
GUI.Label (Rect (10, 10,10000, 10000), "Score: " + SCORE);
GUI.Label (Rect (10, 25,10000, 10000), "1: " + TopScore[5]);
GUI.Label (Rect (10, 40,10000, 10000), "2: " + TopScore[4]);
GUI.Label (Rect (10, 55,10000, 10000), "3: " + TopScore[3]);
GUI.Label (Rect (10, 70,10000, 10000), "4: " + TopScore[2]);
GUI.Label (Rect (10, 85,10000, 10000), "5: " + TopScore[1]);
[COLOR="red"]GUI.Label (Rect (10, 100,10000, 10000), "6: " + TopScore[0]);
GUI.Label (Rect (10, 127,10000, 10000), "Debug: " + DebugScore);[/COLOR]
}
or do you mean something like this?
[COLOR="red"]static var SCORE = 1000;[/COLOR]
var CustomGUI : GUISkin;
static var TopScore = [7000, 5000, 10000, 50000, 100000, 200000];
//I am using a debug score to test it
var DebugScore = 0;
function Update () {
[B][COLOR="red"] //if (isKilled)
SCORE += 1000;
TopScore[0] = SCORE;[/COLOR][/B]
System.Array.Sort(TopScore);
}
function OnGUI () {
GUI.skin = CustomGUI;
//TopScore[0] = DebugScore;
DebugScore = TopScore[0];
//Print out the score
GUI.Label (Rect (10, 10,10000, 10000), "Score: " + SCORE);
GUI.Label (Rect (10, 25,10000, 10000), "1: " + TopScore[5]);
GUI.Label (Rect (10, 40,10000, 10000), "2: " + TopScore[4]);
GUI.Label (Rect (10, 55,10000, 10000), "3: " + TopScore[3]);
GUI.Label (Rect (10, 70,10000, 10000), "4: " + TopScore[2]);
GUI.Label (Rect (10, 85,10000, 10000), "5: " + TopScore[1]);
[COLOR="red"] //GUI.Label (Rect (10, 100,10000, 10000), "6: " + TopScore[0]);[/COLOR]
GUI.Label (Rect (10, 127,10000, 10000), "Debug: " + DebugScore);
}