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);
}
}
}