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.
CodePudding user response:
TMP_Text
is the base/parent class for two types
TextMeshProUGUI
- replacing the now legacyUI.Text
within aUI.Canvas
TextMeshPro
- replacing the now legacyTextMesh
for placing 3D text without using aUI.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.
CodePudding user response:
textmeshproGUI is for UI elements when making tools for unity packages, textmeshpro is for elements in the scene. at least thats my understanding of it