Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Writing on top of an inline sprite for displaying keys / buttons

Discussion in 'UGUI & TextMesh Pro' started by Daerst, Jul 18, 2021.

  1. Daerst


    Jun 16, 2016
    Hi there,

    I'm looking for a way to display a sprite, say an uncaptioned button, and then but some additional text on top of it to e.g. display the keys [ W ] [ A ] [ S ] [ D ] or controller buttons ( A ) ( B ) ( X ) ( Y ), all with the same uncaptioned sprite as background. So far it looks like I have two options: play with the sprite's Glyph Metrics and use a monospace font to write a single character right across it; or prepare captioned graphics for whatever keys I might need and put them into a sprite sheet.

    Being able to write a 'subtext' as caption on top of a sprite and have it nicely centered sounds like a very useful feature to me. The 'subtext' might be chars (ABXY) or might contain sprites in itself (looking at you, Playstation ∆×○□). Does something like this exist yet?

  2. Stephan_B


    Feb 26, 2017
    This will be possible in the next preview release of the TMP package by using / defining Diacritical Marks for the sprite glyphs.

    Check out the example in the following thread.

    In that example, the sprites are positioned relative to a character which is the same thing in regards to this new feature. In this case the Base glyph is the character and the sprite the Mark whereas for your use case, the sprite would be defined as the Base glyph and the character the Mark.
    Daerst likes this.