Setting Up Your UI with TextMeshPro
Using TextMeshPro in your projects allows you to break out of the normal set of fonts used by Unity to a realm of unlimited possibilities. But there are a few steps that you need to take before getting started.
With the latest versions of Unity (2019 & 2020), TextMeshPro(TMP for short) is part of Unity but not quite fully accessible from start. You don’t have to load anything through the package manager to find its options are listed under the UI folder under the Create menu (As seen in the screenshot). TextMeshPro UI elements are like the default elements but have a few more options to work with to allow you to customize your application’s look.
When you first add a TMP element, you will get a pop up window with two options. ‘Import TMP Essentials’ and ‘Import TMP Examples & Extras’.
The ‘Essentials’ imports the basic package needed to run TMP and is all you need if you already have some fonts in mind for your application. The ‘Extras’ contains several Example scenes and five additional fonts.
When you want to access your TMP elements through scripts (and you will), you will need to set up for TMP instead of UnityEngine.UI for your Namespaces.
And all the TextMeshPro class types are prefaced with a TMP_.
But once all this is set up, you can access the elements as if you were using Unity’s UI namespace in most cases.
Now that this has our project all set up to use TextMeshPro, we can start work on a beautiful space themed UI for our game.