In this guide you’ll learn how to create your own custom effects via C#.
P.s. In case you want to create effects from the inspector, please take a look at the “Creating Effects in the Inspector” page.

1. Effect Base Class

TextAnimator has different type of effects, Behaviors and Appearances.
You can create a class for your effect and inherit from the base class of an effect category.

AppearanceBase for appearance effects. (Scripting Api)

public class JumpAppearance : AppearanceBase //<--- for appearance effects

BehaviorBase for behavior effects. (Scripting Api)

public class JumpBehavior : BehaviorBase //<--- for behavior effects

2. Effect Tag

To assign a tag to your effect, simply add the EffectInfo attribute to your class. (Scripting Api)

[Febucci.UI.Core.EffectInfo(tag: "jump")]
public class JumpBehavior : BehaviorBase

Be sure to also add the “UnityEngine.Scripting.Preserve” attribute (as you see in the above example), in order to prevent the compiler to strip the class from the build.

In the above example, the effect will be applied if you write <jump> as rich text tag in the text.

3. Override Methods

Each effect class has to implement a few methods in order to work.
You can find the abstract methods (and also some virtual ones that can help you) in their scripting api section.

👍🏻 You can also take a look at the built-in effects classes and see how they’re implemented.

✅ Done!

You’ve completed all the steps necessary, yay!
The more effects you add, the more this process will sound familiar and simpler.

Have fun applying your effects!