"proper" sprites with TMPUGUI?

Lest this become an a:b problem question, here’s what I want to do, rather than what I’m trying to do:

I want to display icons for keys “press to continue” type stuff. I don’t want to have to generate a sprite image for every possible key, so I want to “compose” icons on-the-fly and have them appear inline with the text.

As for the ‘how’, I can think of a couple of ways to do this, but both have issues. My first attempt was to take and make my blank-keycap sprite have a negative/small BX, so that the next character would appear on top of the keycap, but it turns out that TMP draws sprites AFTER it draw the text, so the characters are behind the sprite. Another thought was to use the link tag and then try to figure out where the character was and move a real gameobject sprite consisting of the keycap and character over it.

Maybe there’s something that could be done at mesh construction time?

I would love any ideas that people have!

– pryankster

You could create a sprite asset that only contains the requires shapes. Ie. Square, Circle, etc.

You would then define the Advance value of these shapes as 0 which means the next character “X” would be inserted on top of the previous sprite.

You might have to define glyph adjustment pairs to ensure the “x” or any other character is properly aligned with the shape. This would be done by assigning a unique unicode value to the shape sprites which would enable you to define these glyph adjustment pairs for your primary font asset.

P.S. I have made a post about this in the past but the search function on the forum is not cooperating right now so I can’t find it :frowning:

I tried that, but it appears that the sprites are drawn in a separate draw pass, AFTER the text (with the text leaving an “Advance” sized hole for the sprite to be drawn on the next pass), thus making the sprite overwrite the text.

Is there any way to change the Z or sort order of TMP sprites?

– pryankster