How do I create custom fonts (digits only)?

This also might sound kinda noobish but here it goes; I want to create a font for my game using a font made of sprites. I already created the sprites here. There are digital number fonts in the internet but they may align to my custom HUD poorly. There’s a way to create custom fonts in Unity by “Create → Custom Font”. But setting this up is kinda like rocket science for me. I got the “2D Texture” and material already set up but the result is kinda stinky. I would like to show the settings of the custom font but I deleted it by frustration. I know there’s TextMeshPro but it seems that I can’t create sprite fonts with it (or I’m doing something wrong).

The characters are limited to 1, 2, 3, 4, 5, 6, 7, 8, 9, - and A.

Here’s the sheet:

And here’s a part of the HUD that should contain these digits:

Any help would be appreciated!

Two things you can consider:

  • Make a sprite atlas, which you can assign to TextMesh Pro. Once you do that, you can insert sprites in the text with a syntax like .
    TextMesh Pro: Sprite Assets - Unity Learn

  • Make your own “DigitsDisplay” VisualElement which, given a number, will create the appropriate count of child elements, each displaying a single digit (you can assign sprites to a VisualElement background).

Hope this helps!

I got it working. Now, since I’m using Bolt, I have to make it so that the “Health” value, which is “100” is replaced by “”. If I get this working then the problem is solved!

Is there still a way to create a “legacy” custom font? TextMesh Pro is too clunky to use for displaying a value in sprite digits. Also, I’m still not experienced with C# scripting yet, sorry!

Just to make sure, are you using Bolt with UI Toolkit or with a UI Canvas? I think using Bolt with UI Toolkit might be challenging since UI Toolkit’s VisualElements aren’t ScriptableObjects.

I’m not sure. I think TextMesh Pro is our only text system that supports sprite atlas. Font files are usually vector shapes, not sprites.

For now, I got it working. Was difficult to set up in Bolt but it worked! There’s a way to make Bolt compatible with TextMesh Pro.