var Timer: int = 0;
function Update () {
Timer++;
guiText.text = "Timer: "+Timer;
yield WaitForSeconds(1);
}
But it says as error
Script error: Update() can not be a coroutine.
So what shall i use instead of Update?
var Timer: int = 0;
function Update () {
Timer++;
guiText.text = "Timer: "+Timer;
yield WaitForSeconds(1);
}
But it says as error
Script error: Update() can not be a coroutine.
So what shall i use instead of Update?
A different function.
var Timer: int = 0;
function Start () {
OtherFunction ();
}
function OtherFunction () {
Timer++;
guiText.text = "Timer: "+Timer;
yield WaitForSeconds(1);
}
Thank U
btw it’s easier than C#.
On C# you must have a function that return a IEnumerator and
yield return new WaitForSeconds(1);
Source: http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.StartCoroutine.html