Text Animator for Unity
More ToolsTutorialsDiscord✨ Get Text Animator ✨
1.X πŸ‡¬πŸ‡§
1.X πŸ‡¬πŸ‡§
  • Installing and quick start
  • Effects
    • How to add effects to your texts
    • Built In Effects List
    • Creating effects in the inspector
  • Typewriter
    • Text Animator Players
    • Triggering Events While Typing
    • Performing Actions While Typing
    • Text Animator Players Sound
  • Extra Customization
    • Writing Custom Effects C#
    • Writing Custom Actions C#
    • Writing Custom TAnimPlayers (C#)
  • Integrations
    • Integrated Plugins & Dialogue Systems
    • How to manually integrate Text Animator
  • Info
    • Support
    • Changelog
Powered by GitBook
On this page
  • Overview
  • Formatting
  • Listening to events
  1. Typewriter

Triggering Events While Typing

PreviousText Animator PlayersNextPerforming Actions While Typing

Last updated 7 months ago

You're reading the documentation of an older/legacy version, Text Animator 1.X. To read the latest version, please visit this page insteadΒ . How to update:


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)


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.

2.X πŸ‡¬πŸ‡§
Upgrading from 1.X to 2.X