Custom Events

You can emit custom events by using the <event="customEvent"> tag. Adding this tag will create a CustomEvent with the name field set to "customEvent".

For example, the following text would emit two events:

<event="wave">Hi! I hope you enjoy using <event="jump"><bounce>animations</bounce>

At the start it emits a CustomEvent with the name "wave", later it emits an event with the name "jump" right when the word "animations" starts to appear.

Reacting to events with the Animated Text Events component

You can add as many custom events as you want. Use the On Custom Event UnityEvent to interact with your scene.

Reacting to events from C#

You can add an event handler to the customEventTriggered event on your animated visual elements.

var animatedLabel = uiDocument.rootVisualElement.Q<AnimatedLabel>("animated-label");
animatedLabel.customAnimationTriggered += YourEventHandler;

Last updated

Was this helpful?