C# Slowly Add Text

I have tried coroutines and multiple other things but how might I go about slowly adding text to a string? So every x second add text to a string. But the x seconds between the text added could vary. So lets say in the beginning every 2 seconds text is added, well that can change sometimes to every 0.25 seconds text is added. Any idea how? I have been trying all day and not sure what to do.

Thank You
Tim

Not sure exactly what You mean, but I am thinking that you want something that would use InvokeRepeating, no?

Numerous ways you could solve the problem. yield being the obvious. Something like this:

IEnumerator DoAutoType()
{
    guiText.text += "a";
    yield return new WaitForSeconds(0.05f);
    guiText.text += "b";
    yield return new WaitForSeconds(0.05f);
    guiText.text += "c";
    yield return new WaitForSeconds(0.05f);
    guiText.text += "d";
    yield return new WaitForSeconds(0.05f);
    guiText.text += "e";
    yield return new WaitForSeconds(0.05f);
    guiText.text += "f";

    // longer delay
    yield return new WaitForSeconds(1f);
    // continue adding like above.
}

Obviously this is a very rigid approach, I’m sure it could be generalized with a bit of effort :slight_smile:

Thank you so much! Figured it out!