GamePad and Keyboard Input Sprites for TextMesh Pro
Version 1.1 © 2025      Alan Robinson     https://insanetechnology.com/~alan/
Contact:   Alan.bork@gmail.com

This Sprite pack is configured for TextMesh Pro's Sprite atlas so that you can add GamePad or keyboard input glyphs to any in-game or UI text with a simple tag (eg <sprite=1>, or <sprite name="dpad">).  For simplicity, glyphs for the Xbox, Switch, PlayStation, and PC Keyboard/Mouse are included all in one sheet, as are some generic gamepad "face" icons.  In order to save space, when one glyph matches multiple devices, such as the dpad, only one variant is included.

This asset costs $0; if it helps you all I request you spend a minute looking at my other assets: 
https://assetstore.unity.com/publishers/84325 
Setup
In order to use the asset you need to configure TextMesh Pro to use it as the default sprite asset (if you wish to use multiple sprite assets you may skip this, and instead use the more verbose approach described here: https://docs.unity3d.com/Packages/com.unity.textmeshpro@4.0/manual/RichTextSprite.html)

This configuration is done using Unity's project settings dialog as follows:

Two icon atlas files are included: "same size" and "larger size".  Same size means that the entire sprite is as close to the height of the plain text surrounding as possible, while still being legible. This means the letter on the key/button will be noticeably smaller than your text.

For better legibility on small screens, use "larger size" which scales up the sprites so that the button labels are nearly the same size as the surrounding text. 

Note this choice only impacts the defaults, you can scale the sprites (or the text) however you want with the <size> tag. 

Example Usage

This example shows how you might use the asset to show a table in your UI summarizing the controls for your game.  The full TMP text to generate this is:

<voffset=1em>Game Controls:</voffset>
<sprite name=xa> <sprite name=space>  Jump
<sprite name=xx>   <sprite name=x>   Set Checkpoint 
<sprite name=xb>   <sprite name=c>   Return to checkpoint
<sprite name=xy>   <sprite name=r>   Reset Level
<sprite name=xmenu>   <sprite name=esc>   Pause / view subtitles

In this example we are using Xbox icons and Keyboard icons. These icons have sensible short names, eg <sprite name=xa> means Xbox styled button A, and <sprite name=space> means keyboard spacebar. Since we are showing multiple lines of text and icons, and using the "larger size" sprites, we need to increase the line spacing so that they do not overlap vertically,  Here, we have set it to 40 (inspector dialog, under spacing options).  If we had used "same size" sprites, the line spacing could have remained as default, though it would have been cramped.

Strictly speaking sprite names are supposed to be quoted according to TMP docs, though in practice you can skip it for almost all names, except the + and - EG:
Quote needed: <sprite name="+"> <sprite name="-"> 
Perhaps surprisingly, no quote needed: <sprite name=n+> <sprite name=~>

Sprite names

The sprites are named by the following convention:
•	Keyboard buttons are just the text on the buttons or their common short name (eg space, win); arrow keys are ku kd kl kr
•	Xbox buttons all start with an x (eg xwin)
•	Switch buttons start with an n (eg n+)
•	Playstation buttons start with a p (eg face buttons are po ps pt px for the circle square triangle X)
•	Joystick icons are shared across all gamepads and start with a j, eg jlclick for clicking the left joystick or jl for the left joystick in isolation. 
•	Bumpers and triggers: lb lt rb rt
•	dpad icons are shared, and all start with a d: du dd dr dl
•	mouse buttons  start with a m: ml mr mm;  for a generic mouse just "mouse". 
•	Generic gamepad face buttons are named for the compass direction:  fe fs fw fn
•	Two bonus icons were fit in the atlas because there was space left over: check for a checkmark and star for a star icon.

Sample Scene
I have included a scene with the simple example above, plus an example of referring to all buttons by their number. It is designed for use with "larger size" atlas.  

Attribution
The major work here was organizing these icons into a sprite sheet that was TextMesh Pro compatible, getting the spacing right, naming the sprites, etc. All this would not have been possible without the work of XELU's (CC0 licensed/public domain) controller and keyboard prompts which I mixed and matched into a single sheet. You can find the complete set here: https://thoseawesomeguys.com/prompts/ 

Note that in addition this asset includes a few additional icons that were hand drawn by me that have no correspondence with icons in XELU's work. You may choose to give attribution to XELU, me, both, or none of the above in your own game. I retain the rights to the Unity asset and it is not available for remixing and republishing on the Unity store or elsewhere. 

Support my work!
This asset is $0 (free), as only makes sense given the heavy dependence on public domain imagery. That said, it took a sold day's work (8 hours!!) to learn the tools involved, select and arrange the icons, and properly set them up for easy Text Mesh Pro use. If you appreciate the time this saved you please consider this token effort: click thru to view my two other Unity assets which are available for purchase:

Improved keyboard control for moving the camera around in the unity editor:
https://assetstore.unity.com/packages/tools/utilities/scene-editor-keyboard-navigator-252637

Use the joystick to move the real mouse cursor and click buttons; all you need to make your menu's pass Steam's requirement for "gamepad support".
https://assetstore.unity.com/packages/tools/gui/joystick-mouse-emulator-for-uis-310328