I am generating (or at least attempting to) a TMP_SpriteAsset at run time, and adding this to the list of fallbacks on the default SpriteAsset.
It is not possible to build the SpriteSheet at compile time, it has to be dynamic for this project.
To do this I am creating an empty TMP_SpriteAsset, along with empty texture and placing the sprites into the sheet as required. I am creating a TMP_SpriteGlyph setting the properties, and then creating a TMP_SpriteCharacter with the unicode 0xFFFE and the glyph created previously.
Assigning a name to the character after it is created.
I then add the Character and then Glyph to spriteCharacterTable
and spriteGlyphTable
.
If at this point I attempt to use the sprites, they appear in the inspector and all values are correct as well as their bitmaps, co-ordinates and names, but TMPro cannot find them by name, and renders the unknown sprite question mark.
OK, so I call UpdateLookupTables()
on my Sprite Asset after adding them, which is mentioned in the docs, however now, the text is only rendered up to the first sprite! at which point it stops, no text or sprites rendered after this point, nothing in the Log or Error log. It just stops!
Inspecting the SpriteAsset and the glyphs and characters are all there as before!
I assume I am missing some key somewhere, anyone able to help?
Unity: 2019.4.26 TMPro: 2.1.4