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.

Fundamental Methods

You have to override/implement the following methods.

float WaitTimeOf(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.

Example

protected override float WaitTimeOf(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.

Example:

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

Optional Methods

You can also override the following methods for extra functionalties.

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