static var scorepoints: int = 0;
function AddToScore() {
scorepoints++;
}
function OnGUI() {
GUI.Label(Rect(970, 0, 500,500),"Points ="+scorepoints.ToString());
}
This code is actually working, but im wondering how am i suppose to put a custom 2D Texture instead just normal text for the Score Board?
If you want a custom texture for the text, you need to get yourself a font. If you want a 2D texture background, just add:
GUI.Box(Rect(970,0,500,500), customTexture);
ah its working great now, thanks !
static var scorepoints: int = 0;
var windowRect : Rect = Rect (20, 20, 120, 50);
function AddToScore() {
scorepoints++;
}
function OnGUI () {
windowRect = GUI.Window (1, windowRect, BringWindowToBack, "SCORE BOARD");
}
function BringWindowToBack (windowRect : int) {
guiText.text = "Points : " +scorepoints.ToString();
}
The guiText is showing behind the window, any idea how to bring it to front so it doesnt stay at the back of the window?