Digital Native Studios

TextMesh Pro

Sprites

TextMesh Pro allows you to include sprites in your text, via rich text tags. Sprites are regular bitmap textures, so make sure that their resolution is high enough.

Sprite Asset

To use sprites, you need a texture atlas. TextMesh Pro uses its own asset to manage them. You can use as many sprite atlases as you like, but keep in mind that using multiple atlases per text object results in multiple draw calls for that object. So you typically use a single atlas.

Creating A Sprite Asset

First, you have to provide a sprite atlas texture. Its Texture Type has to be Sprite (2D and UI) and its Sprite Mode must be Multiple.

Sprite atlas.

Use Unity's Sprite Editor to divide the texture into individual sprites.

Import settings of the default sprite asset.

Next, you can create a new asset via Asset / Create / TextMeshPro - Sprite Asset. You must do this while having a texture atlas selected. This creates a new sprite asset based on the selected texture. You have to keep this source texture, but you can change its type back to a normal texture, because Unity's sprite data is no longer needed.

Using Sprite Assets

To use a sprite asset, put it in a Resources / Sprites folder. This allows TextMesh Pro to find it. You can also configure one sprite asset as the default source for sprites.

Sprite asset.

The sprite asset keeps a reference to its source texture. It also has its own material, which is used to render the sprites.

Sprite List

Here you can inspect the data of each sprite in the atlas, and adjust if it necessary. The sprite list is split into pages, which you can navigate through via the buttons at the top and bottom. You can also filter the list, based on the sprite names. Click on an entry to make it active. This allows you to edit, copy, and remove it.

Default sprite asset.

The name of the sprites have been automatically generated. You can change them to whatever you like, but be sure to make them unique. You can use these names to identify sprites via rich text tags, besides using their ID.

The X, Y, W, and H values define character's rectangular area in the sprite atlas. The OX and OY offsets control the placement of the sprit, defined at its top-left corner relative to its origin on the baseline. The ADV value controls how far to advance along the baseline before placing the next glyph. Finally, SF is a scale factor which you can use to ajust the size of the sprite.