I have a very, very simple function:
void Awake()
{
StartCoroutine(PrintScore());
}
IEnumerator PrintScore()
{
int i;
for (i = 0; i <= Score[CurrPlayer]; i++)
{
ScoreVal.text = i.ToString("#,#");
yield return new WaitForSeconds(.001F);
}
yield return new WaitForSeconds(.001F);
}
This will gradually print from 0 up to the total of the user’s score. It’s working - but it’s really slow. I want to speed it up quite a bit. Any delay is based on framerate; I tried adjusting the framerate, but that didn’t seem to help, nor did waiting for the frame itself. I tried a for loop to try & slow down the main loop (rather than using the WaitForSeconds), but that didn’t work either. Without the delay, you see the final score, rather than the countup.
With the delay, it’s too slow. The for loop doesn’t seem to slow it down, or else “pauses” the entire thing, which I don’t want either.
I also tried putting the main part of the loop in the Awake (or Start) section, and just the coroutine inside the loop, but that doesn’t wait at all either. How can I get this running slow enough to see, but fast enough that the whole thing takes about 1-2 seconds??
Thanks!