All pages
Powered by GitBook
1 of 10

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

CanInterrupt

Property in CoroutineInterruptToken

Summary

public bool CanInterrupt { get };

Interrupt()

Method in CoroutineInterruptToken

Summary

public void Interrupt()

WasInterrupted

Property in CoroutineInterruptToken

Summary

public bool WasInterrupted { get };

Typewriter(TextMeshProUGUI,float,Action,CoroutineInterruptToken)

Method in Effects

Summary

A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI object over time.

public static IEnumerator Typewriter(TextMeshProUGUI text, float lettersPerSecond, Action onCharacterTyped, CoroutineInterruptToken stopToken = null)

Remarks

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.

Parameters

Name
Description

FadeAlpha(CanvasGroup,float,float,float,CoroutineInterruptToken)

Method in Effects

Summary

A coroutine that fades a UnityEngine.CanvasGroup object's opacity from from to to over the course of fadeTime seconds, and then invokes onComplete .

public static IEnumerator FadeAlpha(CanvasGroup canvasGroup, float from, float to, float fadeTime, CoroutineInterruptToken stopToken = null)

Parameters

Name
Description

Effects

Class in Yarn.Unity

Inherits from System.Object

Summary

Contains coroutine methods that apply visual effects. This class is used by LineView to handle animating the presentation of lines.

public static class Effects

Classes

Name
Description

Name
Description

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.

Yarn.Unity.Effects.CoroutineInterruptToken stopToken

A CoroutineInterruptToken that can be used to interrupt the coroutine.

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.

Yarn.Unity.Effects.CoroutineInterruptToken stopToken

A CoroutineInterruptToken that can be used to interrupt the coroutine.

CanvasGroup canvasGroup

float fadeTime

An object that can be used to signal to a coroutine that it should terminate early.

FadeAlpha(CanvasGroup,float,float,float,CoroutineInterruptToken)

A coroutine that fades a UnityEngine.CanvasGroup object's opacity from from to to over the course of fadeTime seconds, and then invokes onComplete .

PausableTypewriter(TextMeshProUGUI,float,Action,Action,Action,Stack<(int position, float duration)>,CoroutineInterruptToken)

A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI object over time.

Typewriter(TextMeshProUGUI,float,Action,CoroutineInterruptToken)

Methods

CoroutineInterruptToken

A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI object over time.

CoroutineInterruptToken

Class in Effects

Inherits from System.Object

Summary

An object that can be used to signal to a coroutine that it should terminate early.

public class CoroutineInterruptToken

Remarks

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 method to mark that the coroutine is no longer running. To make a coroutine stop, call the method.

You can also use the 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

PausableTypewriter(TextMeshProUGUI,float,Action,Action,Action,Stack<(int position, float duration)>,CoroutineInterruptToken)

Method in Effects

Summary

A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI object over time.

public static IEnumerator PausableTypewriter(TextMeshProUGUI text, float lettersPerSecond, Action onCharacterTyped, Action onPauseStarted, Action onPauseEnded, Stack<(int position, float duration)> pausePositions, CoroutineInterruptToken stopToken = null)

Remarks

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

Methods

Properties

Complete()
Interrupt()
CanInterrupt

TextMeshProUGUI text

A TextMeshProUGUI object to reveal the text of

float lettersPerSecond

The number of letters that should be revealed per second.

Action onCharacterTyped

Parameters

Complete()
Interrupt()
Start()
CanInterrupt
WasInterrupted

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.

GetPauseDurationsInsideLine(Markup.MarkupParseResult)
Yarn.Unity.Effects.CoroutineInterruptToken
CoroutineInterruptToken

Start()

Method in

Complete()

Method in

public void Start();

Summary

CoroutineInterruptToken
public void Complete();

Summary

CoroutineInterruptToken