Low level text writing

I am using Unity’s low-level Graphics/GL classes to do the in-game HUD instead of Unity’s GUI due to performance reasons.

I’ve managed to get it to work and it’s great, the only problem that remains is texts. We’ve managed to get most of them done by creating textures that represent characters and using Graphics.DrawTexture(). We’ve done this for numbers (score, hit points etc) but for other texts we’ve used a plain texture (i.e the word “Score” is a single texture).

So obviously this isn’t ideal and now we have the problem of wanting to use different scales (score announcements in different sizes etc).

My question is: is there a low-level parallel of Graphics.DrawTexture() for writing texts in a given font? Or perhaps there is a way to do that from building blocks? I’ve looked for example at the texture in the imported font file but couldn’t figure out how it’s meant to be used.

Any ideas?

I’m fairly sure there is NOT a way to do this. It’s my “most wanted thing”

In short NO, SADLY, YOU MUST USE DIFFERENT SIZE LETTERS FOR DIFFERENT SCREENS.

The standard solution at the moment is either A or B:

A include different sizes for the different screens it will be running on

B include only the “largest” size, and scale down for the “smaller” sizes (wastes a little space)

or I guess C include only the small size, and scale up (results in blurry)

I urge you to get 2dToolkit which completely handles font-like textures. (they are just textures … with “letters on them”) I’d guess that in combination with your system would be ideal. if you get it now you’ll be smiling in 30 minutes. (But you still have to choose A B or C, to be clear.)

I spend about 90% of my life emailing people like the makers of the various GUI kits, 2dToolkot, and Unity, whining that they should

#BUT

.
it looks like Unity4, in fact, finally has dynamic fonts. This is HUGE, HUGE news.

it would be utterly pointless implementing anything at this point, since, U4 will be here soon enough.

I hope this helps in some way. You have stumbled on to the hugest most annoyingest problem in Unity But it looks like they fixed it in 4.

I feel really bad for anyone who was hand-building a proper dynamic font maker - which would have been a mega-money-maker on the asset store.


Just FTR if you hassle all the folks who make gui-replacement-kits, N-d toolkits and the like, they, also, suggest precisely “A” and “B” above … unfortunately that’s about it.