# Writing Custom Effects C\#

> *You're reading the documentation of an older/legacy version, Text Animator 1.X.  To read the latest version, please visit this page instead* [2.X (EN) - Text Animator for Unity](https://app.gitbook.com/o/uOwpPkXHPkAcv95a7lxP/s/JE1tNTWPRG3py6Cs3USD/ "mention")*. How to update:* [Upgrading from 1.X to 2.X](https://app.gitbook.com/s/JE1tNTWPRG3py6Cs3USD/other/changelog/upgrading-from-1.x-to-2.x "mention")

***

In this guide you'll learn how to create your own custom effects via C#.\
\&#xNAN;*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/Disappearances.\
You can create a class for your effect and inherit from the base class of an effect category.<br>

**AppearanceBase** for appearance and disappearance effects.\
\&#xNAN;*Reminder: Disappearance effects are "Appearances" in reverse, so you can create an appearance one and have both automatically.*

```csharp
public class JumpAppearance : AppearanceBase //<--- for appearance effects and disappearances
{
    //[...]
```

**BehaviorBase** for behavior effects.

```csharp
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.&#x20;

```csharp
[Febucci.UI.Core.EffectInfo(tag: "jump")]
[UnityEngine.Scripting.Preserve] 
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.<br>

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.

* EffectBase methods, for all the effects
* Appearance methods, only for Appearance and Disappearance effects
* Behavior methods, only for Behavior effects

👍🏻 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!**
