Revealing effect lags

I’m revealing text with maxVisibleCharacters parameter.

const int n = 1;
for (int i = 0; i < currentDialogue.lines[currentLine].text.Length; i += n)
{
    text.maxVisibleCharacters += n;
    yield return new WaitForSeconds(n / currentDialogue.typeRate);
}

but in the game when text start revealing starts massive lags. FPS drops to 30-15 frames, when normally it’s about 200-100.

Changing MaxVisibleCharacters results in a re-layout of the text which would have some performance impact depending on the complexity and length of the text.

Are you using Text Auto-Size? This would add significant performance overhead.

Compare the performance of the Old Computer Terminal example vs. what you have. Is the performance impact similar?