1️⃣ You're browsing the documentation for version 1.X. If you want to check version 2.X instead, please go here. 1️⃣


Triggering Events while typing

Events are special tags that let you send messages (string) to any listener script, once the typewriter has reached a specific part of the text. (For this reason, events work only if the typewriter is enabled)

textanimatorgif2febucci
Scene 'Example 3 - Events'

Overview

You can write events in your text by using rich text tags.

Formatting

Event’s messages are preceded by a question mark, like this: <?eventMessage>.

Example: To call an event named ‘shakeCamera’, write: <?shakeCamera>

  • 👍🏻 An event can have any kind of tag, including built-in effect’s ones.
  • ⚠️ Events are case sensitive. Writing <?camshake> is not the same as writing <?camShake>

Listening to events

The scripts that you want listen to TextAnimator events/messages must subscribe to the onEvent callback, inside the TextAnimator class. (Scripting Api)

Example:


//Inside your script

public TextAnimator textAnimator;

//Manage the event subscription

private void Awake()
{
    textAnimator.onEvent += OnEvent;
}

private void OnDestroy()
{
    textAnimator.onEvent -= OnEvent;
}

//Do things based on messages
void OnEvent(string message)
{
    switch (message)
    {
        case "something":
            //do something
            break;
    }
}

👍🏻 Note how the “message” string has no ‘<‘, ‘?’ and ‘>’ characters, but only contains the message.

End of the page. Go back to the Documentation Index.