1️⃣ You're browsing the documentation for version 1.X. If you want to check version 2.X instead, please go here. 1️⃣

Writing Custom TAnimPlayers (C#)

By using “Text Animator for Unity” you can create your own custom typewriters, setting different types of delays between letters and much more.
(If you want to learn about the default typewriter instead, read here).

Adding Custom Typewriters

In order to create a custom typewriter for your game, you need to to create a custom class that inherits from TAnimPlayerBase (Scripting API).

Fundamental Methods

You have to override/implement the following methods.

float GetWaitAppearanceTimeOf(char character)

It tells how much time to wait for each character. This way, you can implement your own special characters that need an unique wait time.


protected override float GetWaitAppearanceTimeOf(char character)
    switch (character)
        case ',': return 0.3f;

        case '!':
        case '?':
        case '.': return 0.6f;

    return 0.1f;

IEnumerator WaitInput()

Waits for input in order to continue showing text.


protected override IEnumerator WaitInput()
	while (!Input.anyKeyDown)
		yield return null;

Optional Methods

You can also override the following methods for extra functionalities.

float GetWaitDisappearanceTimeOf(char character)

Override this method in case you want different disappearance wait times/speed. Otherwise, your custom textAnimatorPlayer will use the same delays as its typewriter (GetWaitAppearanceTimeOf);

IEnumerator DoCustomAction(TypewriterAction action)

Override this method to manage your custom actions. Read more here: Writing Custom Actions (C#))

virtual void OnTypeWriterStart()

Invoked every time the typewriter is starting to show the text. It doesn’t fire up if the typewriter is set to false.

✅ That’s it!

Have fun implementing your own players <3

End of the page. Go back to the Documentation Index.