Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Method in Effects
A coroutine that fades a UnityEngine.CanvasGroup
object's opacity from from
to to
over the course of fadeTime
seconds, and then invokes onComplete
.
Name | Description |
---|---|
float
from
The opacity value to start fading from, ranging from 0 to 1.
float
to
The opacity value to end fading at, ranging from 0 to 1.
A CoroutineInterruptToken that can be used to interrupt the coroutine.
UnityEngine.CanvasGroup
canvasGroup
float
fadeTime
Method in Effects
A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI
object over time.
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.
Depending on the value of lettersPerSecond
, onCharacterTyped
may be called multiple times per frame.
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.
Name | Description |
---|---|
TMPro.TextMeshProUGUI
text
A TextMeshProUGUI object to reveal the text of.
float
lettersPerSecond
The number of letters that should be revealed per second.
System.Action
onCharacterTyped
An System.Action
that should be called for each character that was revealed.
A CoroutineInterruptToken that can be used to interrupt the coroutine.
Method in Effects
A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI
object over time.
Essentially identical to Typewriter(TextMeshProUGUI,float,Action,CoroutineInterruptToken) 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.
Depending on the value of lettersPerSecond
, onCharacterTyped
may be called multiple times per frame.
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.
Name | Description |
---|---|
TMPro.TextMeshProUGUI
text
A TextMeshProUGUI object to reveal the text of
float
lettersPerSecond
The number of letters that should be revealed per second.
System.Action
onCharacterTyped
An System.Action
that should be called for each character that was revealed.
System.Action
onPauseStarted
An System.Action
that will be called when the typewriter effect is paused.
System.Action
onPauseEnded
An System.Action
that will be called when the typewriter effect is restarted.
System.Collections.Generic.Stack<(int position, float duration)>
pausePositions
A stack of character position and pause duration tuples used to pause the effect. Generally created by GetPauseDurationsInsideLine(Markup.MarkupParseResult)
A CoroutineInterruptToken that can be used to interrupt the coroutine.
Class in Effects
Inherits from System.Object
An object that can be used to signal to a coroutine that it should terminate early.
While coroutines can be stopped by calling UnityEngine.MonoBehaviour.StopCoroutine(System.Collections.IEnumerator)
or UnityEngine.MonoBehaviour.StopAllCoroutines
, this has the side effect of also stopping any coroutine that was waiting for the now-stopped coroutine to finish.
Instances of this class may be passed as a parameter to a coroutine that they can periodically poll to see if they should terminate earlier than planned.
To use this class, create an instance of it, and pass it as a parameter to your coroutine. In the coroutine, call Start() to mark that the coroutine is running. During the coroutine's execution, periodically check the WasInterrupted property to determine if the coroutine should exit. If it is true
, the coroutine should exit (via the yield break
statement.) At the normal exit of your coroutine, call the Complete() method to mark that the coroutine is no longer running. To make a coroutine stop, call the Interrupt() method.
You can also use the CanInterrupt property to determine if the token is in a state in which it can stop (that is, a coroutine that's using it is currently running.)
Name | Description |
---|---|
Name | Description |
---|---|
An object that can be used to signal to a coroutine that it should terminate early. |
A coroutine that fades a |
A coroutine that gradually reveals the text in a |
A coroutine that gradually reveals the text in a |