I wrote a simple script but after 10 seconds it wont really show the score. The script has no errors
function OnGUI()
{
GUILayout.Label( "Amount of Coins = " + score );
}
var Time = 10;
var score = 0;
if (Time < 0) {
score += 5;
}
Your code
var Time = 10;
var score = 0;
if (Time < 0) {
score += 5;
}
isn’t in any function, so it is never being executed. Put it into the update function, and decrement the time variable. I would suggest a few tutorials on programming first.
would this work?
var time = 10;
var score = 0;
function OnGUI()
{
GUILayout.Label( "Amount of Coins = " + score );
}
function getcoins()
{
time -= Time.deltaTime;
if(time <= 0){
score += 5;
}
}