- Home /
Guitext for score over time.
please can someone help with a script in c# to implement and increase in score over time.
For example every second score will go up by 5.
Answer by gregzo · Apr 14, 2012 at 11:46 PM
var delay : float; //delay of the Invoke, in seconds
var repeatTime : float //interval at which the function will be fired
var score : int;
var scoreIncrease : int;
function Start()
{
InvokeRepeating("IncreaseScore",delay,repeatTime);
}
function IncreaseScore()
{
score+=scoreIncrease;
}
Don't forget to say thanks! Actualy, please would have been nice too...
sorry i never said please. and thank you. however that makes no sense to me as i require c# know where i can go to change it over?
dude, you can look at it and just see what it is in C#, e.g var delay : float
, so that means delay is a float and IncreaseScore doesn't return anything so its a void function. etc. a lot of Unity Script(A$$anonymous$$A java script) is very very similar to C#
Answer by Eric5h5 · Apr 13, 2012 at 07:43 AM
Should be GUIText rather than GUITexture. You can use InvokeRepeating.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Weird GUILayout Scrollview Behavior 0 Answers
Trigger GUI with a key when colliding (C#)? 1 Answer
NullReferenceException problem 2 Answers