For exercise i create a javascript for a timer :
#pragma strict
var t:int = 60;
function Start () {
decrementa();
}
function Update () {
}
function decrementa(){
while(true){
t=t-1;
yield WaitForSeconds(1);}
}
function OnGui(){
GUILayout.Label(t.ToString());
}
Why the gui dosen’t function?
p.s. sorry for the grammatical errors but i’m italian
Sorry but like this for me it is hard to read your code, please make it for other more organized.
And OnGui() must be → OnGUI()
You havent Done it right its in caps
OnGUI not OnGui
var t:int = 60;
function Start () {
decrementa();
}
function Update () {
}
function decrementa(){
while(true){
t=t-1; yield WaitForSeconds(1);
}
}
function OnGUI(){
GUILayout.Label(t.ToString());
}