How to add effects to your texts
In this page you will learn how to add effects to your text.
Last updated
In this page you will learn how to add effects to your text.
Last updated
You're reading the documentation of an older/legacy version, Text Animator 1.X. To read the latest version, please visit this page instead . How to update:
P.S. Be sure to have implemented Text Animator in your scene. Read more here: Installing and quick start
Effects are divided in three categories, based on their functionality/application. They consist of:
Behavior Effects animate letters continuously during time, after the letter has been shown.
Appearance Effects animate letters only when they're appearing on screen. For this reason, they're mosty used in combination with the typewriter, which shows letters one after another.
Disappearance Effects make letters dynamically disappear, and under the hood they're simply Appearance effects in reverse.
A list of all built-in effects is available here: Built-in effects
You can set different effects to your text in two main ways:
You can set which effect(s) will be applied to all letters by default in the TextAnimator component, without having to write effects tags for every text.
Head over to the TextAnimator component
Expand the "Set Default Appearances" or "Set Default Disappearances" section
Edit the array and add any appearance tag you want to include. Add any effect tag you want to include, example:
👍🏻 If you don't want any effect applied by default, simply set the effects' count to zero.
You can also apply effects to specific parts of your text by using rich text tags, overriding the default ones (if any).
The effects tag will look like this:
Behaviors: <tag>
to open, </tag>
to close
Appearances: {tag}
to open, {/tag}
to close
Disappearances: {#tag}
to open, {/#tag}
to close
(basically an appearance tag with a #
before it, to simply remind you that disappearances are appearances in reverse).
Once you close an effect tag, the letters will be affected again by the default effect (if any is set).
Example: "I'm cold
" can be written as "I'm <shake>cold
" (in the text component) in order to apply a shaking behavior effect on the specific word "cold".
Modifiers let you change the characteristics of your effects individually, and can be used in all effects categories.
Example: You could have an effect that is stronger than the previous one, but still in the same dialogue line, like "I was <wiggle>
strong</wiggle>
... but now I'm<wiggle a=3>
three times stronger</wiggle>
!!!"
"Modifiers" multiply the relative value; this way you can easily know how much stronger/weaker a modified effect will result compared to the base one (for this reason, a modifier of "1" will return the same result of a base value).
All Modifiers are structured like this: <effectID modifierID=modifierValue>
and you can also use multiple of them (eg. <wiggle a=2 f=4>
).
You can read a list of all the available modifiers for each effect: Built-in Effects list
Example for Appearances effects: {fade d=3}
.
Example for Disappearance effects: {#fade d=2}
.
Some extra notes:
👍🏻 You can use modifiers when declaring "" effects as well
⚠️ Do not write identical attributes in the same tag, since only the last one will take effect.
⚠️ Be sure to remove spaces between the modifierID, the '=' symbol and its value
By using TextAnimator for Unity:
You can stack multiple effects together (e.g. "<shake><size>
").
You can close all currently opened effects with a single '/
' character, like:
"</>
" for Behavior Effects
"{/}
" for Appearance Effects
"{/#}
" for Disappearance Effects.
There is no need to close tags if you're at the end of the text.
More than default effects, you can also create your own.
Create Effects from the Inspector: Creating effects in the inspector
Write Custom Effects (C#): Writing Custom Effects C#
You can tweak built-in effects' values in the TextAnimator component.
Expand the category of the effect you want to edit. (Behavior effects or Appearance effects)
Expand the effect you want to edit.
You can also use the same built-in effect values for multiple TextAnimator components.
In your project folder, create the scriptable object asset of your effect category (Behaviors/Appearances).
Assign the scriptable object to the Text Animator component you want to share the values with.
👍🏻 Any TextAnimator that contains the same built-in scriptable object reference will share its same effect values.
You can setup uniform effects' behavior on different screen resolutions.
Reference Font Size
: represents the size where objects behave as expected. As a reference, you can pick the font size in your unity editor.
⚠️ Some effects act differently based on different fonts and sizes. You can read which effect is affected here*: Built-in Effects list*
👍🏻 In order to "fix" this, you can use the variable effectIntensityMultiplier
to scale all the affected effect's amplitudes in the TextAnimator component.
Simple explanation: an effect's strength of 2 could result weak in UI units (pixels), but really strong in world units. Then there is the font asset size etc.
This value will multiply only the affected variables, leaving unchanged the ones that are independent from different fonts and sizes.
You can change the effects TimeScale
mode in the "TextAnimator" component.
Scaled: effects will slow down / pause based on the game Time.timeScale
Unscaled: effects will update even if the game is paused (Time.timeScale = 0)
If you have the typewriter enabled, its timescale will match the relative TextAnimator's timescale (which means that you can also show letters when the game is paused by setting the timescale to "unscaled").
⚠️ If the game timescale is negative TextAnimator will act like it's paused, but it will automatically resume once it's greater than zero.