You can use
Typewriters to show and hide letters dynamically, choosing different pauses for any kind of characters (punctuation, letters, […]), trigger events and more.
There are different types of typewriters, for example “
By Character” which shows one letter after the other, or “
By Word” which progresses text word after word.
After choosing which Typewriter to use (thus by adding its related component on the same gameObject that has a TextAnimator one), you can start it in two main ways:
A) Via Code (Recommended)
tmproText.text = textValue;” with
typewriter.ShowText(textValue); in your code (Scripting API).
B) Via the “Easy Integration”
Enabling the “
Typewriter Starts Automatically” option in the TextAnimator component (p.s. this was previously called “Easy Integration”).
This will let the plugin automatically check for text changes from your TextMeshPro’s component and start the typewriter based on it.
Start and Stop Typing
Inside the component’s Inspector you’ll find some options to control how the typewriter start should be triggered:
Start Typewriter Mode: tells the typewriter when to start showing letters.
- From Script Only: the typerwiter can only be started by invoking TextAnimatorPlayer.StartShowingText().
- OnEnable: the typewriter starts every time the gameObject is set active
- OnShowText: the typewriter starts as soon as a new text is set (as explained in the “Showing Text” section).
- Automatically From All Events: all of the above
Reset Typing Speed At Startup: true if you want the typewriter’s speed to reset back to 1 every time a new text is show, otherwise it will save the last one used.
You can also test this in Play Mode from the Inspector (the buttons are only greyed out in Edit Mode).
To Skip the typewriter, you can invoke the typewriter.SkipTypewriter() method.
You can also find a few options to control how it behaves:
Hide Appearances On Skip: true if you want to prevent appearance effects from playing whenever the typewriter skips (meaning that the text will be shown instantly).
Trigger Events On Skip: true if you want to trigger all remaining events once the typewriter skips (be careful with that if you’re running some game logic with them, as everything will be run at once). Read more about events here.
You can also test this during runtime through the buttons in the Inspector.
You can create your own typewriter (read here how to create a custom typewriter via C#) or you can use the built-in one.
Typewriters might share the same settings and also have specific ones, so be sure to hover the mouse cursor above its fields in the Inspector to show the tooltips for each one.
Here is a quick overview of the most important/common ones:
Callbacks (Unity Events)
You can use Unity Events that will be triggered based on the typewriter activity (example: when it just ended showing text).
OnTextShowed: event called after the entire text has been shown (if you’ve set “Use Typewriter” to true, it will wait until all letters are shown).
OnTextDisappeared: called as soon as the script starts hiding the last letter.
The following below only work if the “use typewriter” is set to true:
OnTypewriterStart: called right before the typewriter starts showing its first letter.
It doesn’t work if the typewriter is off, since it would coincide with the “OnTextShowed” event (in this case you can use that one instead)
OnCharacterVisible(Char): called each time a character became visible.
OnMessage(EventMarker): invoked every time the typewriter meets a message/event in text. Read more about events here.