"waitforseconds" Difference in Editor vs. Android Phone

Both “waitforseconds” and “WaitForSecondsRealtime” are having synchronizing issues.

I am creating a game with many animations and detail is important. I am using coroutine to type text word-by-word. On editor text is showing on the time i want it to but on android phone text is lagging.

Why is it so?

    IEnumerator TypeTextDown(float initialWaitTime, string stdown, float time)
    {
       //initial wait time (type only when the orator speaks)
        yield return new WaitForSeconds(initialWaitTime);

        // iterate over total alphabets and wait a little once a sentence is complete.
        for (int i = 0; i < stdown.Length; i++)
        {

            if (i < stdown.Length)
            {
                if (stdown *== '.')*

{
yield return new WaitForSeconds(1f);
down.text = “”;
}
down.text += stdown*;*

// wait after each sentence
yield return new WaitForSeconds(time);
}
}

}

It’s usually good practice to define a WaitForSecond only once, when you need the exact same length multiple times. Because you can save resources and garbage collector work-time. So because you are saying, you have multiple instances, it could improve your performance here a bit.

What i mean is:

Replace:

for(...){        
    //your stuff
    yield return new WaitForSeconds(1f);

    //your other stuff
    yield return new WaitForSeconds(time);
}

with:

WaitForSeconds myWaitFor1Sec = new WaitForSeconds(1f);
WaitForSeconds myWaitForTime = new WaitForSeconds(time);

for(...){        
    //your stuff
    yield return myWaitFor1Sec;

    //your other stuff
    yield return myWaitForTime;
}

Not sure if it helps you here really, but you could give it a try.

This shouldn’t happen , I have used this method many times to write text. There must be something else in process which is causing lag.
Use a FPS Counter with / without this co routine.
Check you project settings. disable vsync