Typewriter Effect and Text Animation in Unity

Last reviewed

Short answer

A typewriter effect reveals text one character at a time, and text animation moves, scales or recolors characters over time. TextMesh Pro offers the building blocks, a visible-character limit and access to the mesh vertices, and dedicated assets add effects and tags on top of it.

UniText has both built in: a reveal engine with nineteen appearance effects and reverse hiding, twelve looping motion effects driven from markup, and a timeline sequencer. It reveals whole grapheme clusters in logical order, so Arabic, Indic scripts and emoji never appear half-formed.

The usual options

  • TextMesh Pro by hand. maxVisibleCharacters, maxVisibleWords and maxVisibleLines limit what is shown, and effects are written by editing the mesh vertices every frame, as the TMP example scripts do. The two interact: changing the visible count resets vertex edits, and the suggested workaround is to reveal characters by changing their alpha instead.
  • UI Toolkit. Since Unity 6.2, TextElement.PostProcessTextVertices lets code change each glyph's position, tint and UVs after layout. It is a hook for writing effects, not a set of ready ones.
  • Text Animator for Unity (Febucci), the best-known asset, animates TextMesh Pro from Unity 2022.3 and UI Toolkit from Unity 6.3. Its typewriter reveals by letter or word, and tags inside the text wait for time or player input, fire events and play a sound per letter. Effects play as appearance, persistent or disappearance animations, and it integrates with Yarn Spinner, Ink, Dialogue System for Unity, Naninovel and Unity Localization. Its FAQ leaves language support to TextMesh Pro and notes that RTLTMPro might not be fully supported.
  • TMPEffects, a free MIT-licensed package, adds tag-based animations and a writer with commands and events on top of TextMesh Pro.
  • Super Text Mesh is its own text renderer rather than a TextMesh Pro add-on, with tags for waves, jitter, delays, events, voices and inline images.

For a dialogue-heavy game built on Yarn Spinner, Ink or a dialogue system, with waits and sound cues written into the lines, Text Animator's ready integrations save real work. Where the text itself is the hard part, in Arabic, Indic scripts, Thai or emoji, or where the same effects should run on world-space and extruded 3D text, an engine that animates correctly shaped text is the better base.

Typewriter reveal in UniText

RevealModifier shows only the leading part of each covered range. Its Front is a percentage or an absolute number of grapheme clusters, set from code, from markup as <reveal=fade,50%>, from an Animator, from Timeline or from the built-in sequencer.

  • Appearance effects: Fade, Slide, Scale, Spin, Flip, Skew, Stretch, Spiral, Pop, Drop, Rain, Burst, Domino, Swing, Wave, Shake, Glitch, Chaos and Tint, combinable and with your own easing curves.
  • A receding front plays a hide effect, by default the appearance replayed backwards, and reversing mid-way continues from the current state instead of restarting.
  • Hidden text can keep its space or collapse out of the layout, and line breaks never move while the text appears.
  • Clusters are revealed whole, in logical order: an Arabic letter appears already joined, a Devanagari syllable with its vowel sign, an emoji family as one picture.
  • Several ranges can reveal one after another or all at once, each with its own effect.
csharp
using LightSide;
using UnityEngine;

public class DialogueLine : MonoBehaviour
{
    [SerializeField] UniText text;
    [SerializeField] float charactersPerSecond = 40f;

    float elapsed;

    void Update()
    {
        elapsed += Time.deltaTime;
        text.GetModifier<RevealModifier>().Front = UnitValue.Absolute(elapsed * charactersPerSecond);
    }
}

Looping text effects

Motion effects are styles you apply with tags such as <wave> or <shake>. Each renders from a single phase value, so the same phase always gives the same frame: effects can be scrubbed, rewound and driven by Timeline, an Animator or your own code as well as by their own clock.

EffectMotion
Wavea sine travelling along the text, or glyphs orbiting on an ellipse
Shakedeterministic per-glyph jitter
Bounce, Float, Pendulum, Wobblehops, drifting, swinging and jelly rocking
Spin, Pulserotation and scale pulsing about each glyph
GlitchRGB-split glitch bursts
Rolling, Scramblecharacters rolling on a wheel, or decoding left to right
Marqueethe whole text scrolling through its box like a ticker

UniTextDriver sequences any of these, and any other style parameter, on a timeline with staggered clips per range, edited in the Inspector without code.

Questions

Can I play a sound for every revealed character?

Drive Front from your own script and play the sound whenever its whole-number part advances. Per-character event tags in the text itself are not a built-in feature.

Does reveal work on world-space and 3D text?

Yes. Reveal is a style like any other, so it applies to UniText, UniTextWorld and UniText3D alike.

Can effects be combined?

Yes. Several appearance effects run together in one reveal entry, and motion effects are separate styles, so a text can wave and fade in at the same time.

Check it in your project

Run the browser demo, follow the setup guide, or compare the free version with the licenses.

Related problems