Summary: Here I demonstrate a scaling text effect in Unity. Running and updating as the game’s text updates at runtime.
Use case: Special effects for damage meters, Health meters, bonus games left meter, countdown timers etc…
Prerequisites: TextMeshPro (or you can use any Unity Text Area. Only thing that will change would be the classes the script calls.)
Here is the step by step guide.
Setup Text Areas
Using Text Mesh Pro or any other Unity Text Area tool setup 1 main and 3 duplicate text areas. Now Format each as you prefer, I keep an outline for the duplicates.
Setup Animations
Next up, you’ll setup the animation for the scaling effect. Each one of the duplicate text areas will scale and reduce alpha to zero over time. You can stagger each one the duplicates to have the same effect. Or you could try out any other effects you like. Color changes, flashes, skewing, flip, mirror etc…
Setup Script
To copy text from our main text area to the duplicates, we will write a copy paste text area script. I should have setup a list instead of this quick and dirty code. Here’s the article I used to find this code.
https://forum.unity.com/threads/changing-textmeshpro-text-from-ui-via-script.462250/
Lastly, incase you are using something else other than Text Mesh Pro, you’ll need to call a different variable type and namespace to edit the text area string values for each text area.