TMPro Sprite Asset sprite glyphs randomly lose their source rect layout and are broken in build

My team is using Text Mesh Pro’s inline sprite feature to display controller button icons within texts. This works perfectly fine in the editor most of the time. I have configured our glyph sprites with correct source rects on the sprite atlas and specific offset values for placement within text. Then I selected the “Update Sprite Asset” option in the context menu and saved the project. The setup is very simple and basically the same as the default example. In the editor, in play mode, the glyphs usually show correct.

However, sometimes (in the editor and the build player), the glyphs randomly show with incorrect layout rects, like this:

5391045--546714--image (1).png

This happens without anyone having touched the Sprite Assets and the stored glyph values look fine:

5391045--546717--upload_2020-1-20_21-5-53.png

When the sprites are not displayed correctly in play mode, I can temporarily fix the issue by selecting “Update Sprite Asset” once more. This seems to apply the changes, however, it only works until I reopen Unity. Basically, the option doesn’t seem to save correctly. I tried to ensure, that the asset is somehow set dirty (changed oder values while also changing the glyph rects) and then saved the project again, but I’m unsure if this is a valid workaround since I’m still seeing the issue on other machines.

Any ideas how to work around this issue?

We’re on Unity 2019.2.17f1 and Text Mesh Pro 2.0.1.

How are you defining the position of the Sprites in the Sprite Asset? Are you defining those by selecting the texture and then using the Unity Sprite Editor?

The Update Sprite Asset context menu should only be used when the position of the sprites in the texture have been adjusted or new sprites have been added. Using Update Sprite Asset when those sprites have not have been defined in the texture / Sprite Editor is likely to have the affect of resetting the manual adjustments.

Also please test the above with the latest preview release of TMP which is version 2.1.0-preview.3.