PausableTypewriter(TextMeshProUGUI,float,Action,Action,Action,Stack<(int position, float duration)>,CoroutineInterruptToken)
Last updated
Was this helpful?
Last updated
Was this helpful?
Method in
A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI
object over time.
Essentially identical to but supports pausing the animation based on pausePositions
values.
This method works by adjusting the value of the text
parameter's TextMeshProUGUI.maxVisibleCharacters
property. This means that word wrapping will not change half-way through the presentation of a word.
Due to an internal implementation detail of TextMeshProUGUI, this method will always take at least one frame to execute, regardless of the length of the text
parameter's text.
TextMeshProUGUI
text
A TextMeshProUGUI object to reveal the text of
float
lettersPerSecond
The number of letters that should be revealed per second.
Action
onCharacterTyped
An System.Action
that should be called for each character that was revealed.
Action
onPauseStarted
An System.Action
that will be called when the typewriter effect is paused.
Action
onPauseEnded
An System.Action
that will be called when the typewriter effect is restarted.
Stack<(int position, float duration)>
pausePositions
A stack of character position and pause duration tuples used to pause the effect. Generally created by
stopToken
A that can be used to interrupt the coroutine.