Trigger Events when typing

Events are special tags that let you send messages (delegates with a FEventMarker parameter) to any listener, 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>. Be careful! (or use the FString.ToLower() method in your scripts to account for that.)

Parameters

Events can have one or multiple parameters (starting with the = sign for the first, and then separating the others with a comma ,), to allow you to send multiple data to your code or Blueprints.

  • One parameter: <?eventID=parameter1>, will result in a message “eventID” and one parameter “parameter1”.

  • Multiple parameters: <?eventID=p1,p2>, will result in a message “eventID” and parameters “p1” and “p2”.


Listening to events from C++

The code that you want to listen for events/messages must subscribe to the FOnMessage delegate inside the UTypewriterCore class.

Example:

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

Listening to events from Blueprints

Subscribing to events from Blueprints is also straightforward. Assuming you have a reference to an AnimTextBlock in one of your custom widgets, just bind an event to the OnMessage delegate of its typewriter on On Initialized and unbind it on Destruct.

Example: