While making a game with Unity, I was curious about the difference between TMP_Text and TextMeshProUGUI in TMPro. Please let me know what is different from each other. I'd appreciate an example of when to use it.
I don't know why TMP_Text and TextMeshProUGUI are separated and used separately in Unity.
TMP_Text
is the base/parent class for two types
TextMeshProUGUI
- replacing the now legacy UI.Text
within a UI.Canvas
TextMeshPro
- replacing the now legacy TextMesh
for placing 3D text without using a UI.Canvas
This second one is where the name of the entire package originally comes from. It was a custom improved TextMesh
until Unity adopted it into the core.
So if you want to be more generic (loosely coupled) and make your component work in theory with whatever will be used for displaying that text later you use TMP_Text
so both can be used the same way.