ONGUI not working correctly, does code placement matter?

I am making a dice game and the problem i have is not the dice rolls, but the fact that OnGUI is not showing the “unbanked” score at the bottom of the code.

#pragma strict

function Start () {

}
//

var dice1:int;

var dice2:int;

var dicetotal:int;

var runningscore:int;
 
var unbanked:int;



function Update () {

if(Input.GetKeyDown("space")){
dice1=Random.Range(1,7);//make the dice show 1-6
dice2=Random.Range(1,7);//make the dice show 1-6
}


if (dice1==1||dice2==1){
badroll();
}

if(dice1>1&&dice2>1){
gettotal();


}

}

function badroll(){
dicetotal=0;

}
//
function gettotal(){
dicetotal=dice1+dice2;
unbanked=dicetotal*3000;

}

function OnGUI(){


GUI.Label(Rect(10,10,100,20),"You rolled a "+dice1);//dice1 throw
GUI.Label(Rect(10,30,100,20),"You rolled a "+dice2);//dice2 row

GUI.Label(Rect(10,60,100,20),"JUST EARNED "+unbanked);//
}

For any help, please format your code. You can do this by highlighting all your code, then clicking the 10101 button at the top of the edit window. Watch : http://video.unity3d.com/video/7720450/tutorials-using-unity-answers

1 Answer

1

You do know that 20px wide is not enough to display your label, right?

20px is the height, but nevertheless 100px likely isn't wide enough either.

Thanks that solved it.