font re-size on teh fly via script.

ok, is there really no way of re-sizing a font on the fly at the moment with script?

I know I can import a whole heap, and swap them out on the GUIText on the fly, but that really doesnt suit… not with soooooo many resolutions available to the game player.

Im not interested in turning Pixel Correct off… that just makes blury text.

Please someone tell me I a missing something sooooo obvious!

The font is imported by generating a texture at import time, so it is no possible to resize it at run-time.

freyr: Bummer… lets hope there is something cool coming in Unity’s next release that will allow this!

Thanks!

I ran into this issue the other day. Right-click on the font in your assets, and choose “Import Settings…”. From there you can change the resolution at which the font is imported. 64 or so should be good unless you need really big text somewhere. Set the filtering for the font texture (a child of the font itself) to trilinear. Now you can turn off “Pixel Correct” and scale without blurry text.

Hey Muriac… that doesnt help me… I need to be able to change the actual imported font size on the fly via script at runtime. Thanks though.

Why do you need to change the imported size?

I want sharp text/fonts that displays at an altered font size depending on what resolution people are playing in.

As I wrote initially, turning off Pixel Correction blurs the text too much.

Because there are so many resolutions someone can chose from to play Unity games, other then blury fonts, the only other options it to import a whole heap of fonts (varying sizes) and then swap them out on the fly once the game has checked the users screenwidth/height.

We have it working like that here, and its better than blury text… but not what we hoped for… if we could re-size on the fly… then we could adjust exactlyt what we need per screen res.

Try turning up anisotropic filtering of the Inspector of the font’s texture. That should take care of the blurryness pretty well.

Cheers,
-Jon

Cool, I’ll check that out tomorrow, thanks for the pointer :slight_smile:

Been another looooong day today in fornt of Unity, and loving it even more than yesterday :lol:

Bed time for me now!

Seon.

Or you can simply create multiple versions of a Font (e.g. Arial 16, Arial 18, etc) and then create a Font Manager which has all the possible fonts and returns the font size you want.

Regards,
Afonso

Hey nafonso,

You I have that implemented already, (as per my initial post) but it still isnt suitable,. unless I make an exact font szie for EVERY resolution (which I have almost done already). But that means I have to be able to test it on every resolution. Luckily I have a Dell 30" screen at work running 2500x1920… so at the moment I can test all resolutions… but it makes it hard when I am developing on my MacBook Pro at home :frowning:

Cheers :slight_smile:

If you just use one font texture that is huge and manage to have it work for all resolutions without being pixel correct, it should look ok. Especially with anisotropic turned on like jon said.

Or you could probably just get by with a few different font size levels.

Ok, i finally caved and imported a HUGE font, turned Anistropic AA right up and turned off pixel correction.

It works… and it’s nice enough, though would still like a better way of doing this.

I would also love the ability to set any font to be monospaced ! That would rock !