I am adding all the icons to a XR world canvas UGUI interface and I am deciding how to add them.
I can see very different different approaches and I don’t discern a clear winner.
These are my options:
- Use Single sprites. Very flexible, but not the best performance
- Sprite Atlas. Still using sprites, but better batching
- TextMeshPro Sprite Sheet. I don’t see any advantage to this approach, because I am not merging text and icons together. Also, you need to have a texture that is already a sheet, you can not have individual icons (at least I didn’t see how)
- TextMeshPro SDF font. That would be my prefer option, adding the icons to a font and be able to use the SDF algorithm to render the icons, but I have not been able to add the icons to a font. I suppose that adding the icons to a font should be done with an external tool, but I didn’t find any.
So I am tempted to use option one, since I don’t have so many icons (I don’t have an inventory or anything like that) but I would like to hear some thoughts on this
Regards
@HugoBD-Unity sorry to invoke you but I’d really like to know your opinion here.
What do you think is the best approach to include icons in an app?
(sprite, sprite atlas, TMP sprite sheet, or icon font?)
More context: I don’t have too many icons, and they are plain white, but the visibility is very important because this is an AR application, that’s why I think the best approach would be a font icon.
The problem with a font icon is I didn’t find a proper way to create it. I reckon is exporting all icons to SVG, then using (some) tool to create a ttf, and to TMP from there
Hi @Maeslezo! TextMeshPro rasterizes only black and white glyphs using SDF, while color glyphs are rendered as bitmaps. Are your icons in color?
No, they have no color, they are monochromatic
I’m not too familiar with the different Sprites alternatives, but creating your own Icon Font seems like a solid approach if you’re looking for the scaling benefits of SDF and efficient atlas packing.
Some recommendations: assign your custom icons to the Private Use Areas to avoid conflicts. I’d document the Unicode-to-Icon mapping for clarity. You can insert icons using Unicode Escape Sequences, e.g., \U0000E000
.
Let me know if you decide to explore this approach!