Custom Fonts trouble

Hi,

I’m not sure this is the right place for this. If it isn’t, I’ll move it.

I’ve been trying to make a custom font for a Unity project. I’ve followed every tutorial I’ve found here and on the Wiki, but all I get is an opaque white square. What am I doing wrong? I’ve tried various image formats, various ways of adding transparencies and various shaders, but no luck. Any ideas?

Also, as a side note, Unity builds seem to load up pretty quickly, but would it be possible to add something like a loading screen?

You can import a TTF font into Unity just by adding it to the project. Most text based things in Unity either accept the font directly as a parameter (or via a GUIStyle in the case of GUI functions).

You can create a loading screen by adding an extra scene that just displays the loading message. You can then call Application.LoadLevelAsync from a script in this scene to pull in the next proper scene in the background. You still have script control while this is happening, so you can create some nice visual display or play music while the new level loads.

I expressed myself ambiguously. What I meant was that I want to make a font of my own, by importing an image and using it as a custom font.

Really? That’s pretty neat. If everything didn’t load up more or less instantly, I’d look into that. Would it be possible to make a loading progress bar, then? I’m guessing “no,” but there’s a lot I do not grasp yet.

It was once possible to import a texture into Unity to create a font, but this has been superceded by the current font import system. (I don’t think you can still use the old system but I’m happy to be proven wrong on that :wink: )

It is actually possible to show a progress bar while using LoadLevelAsync. The function returns an AsyncOperation object that lets you monitor the loading progress. You can use the object’s isDone property to detect when it finishes, and there is even a handy progress property you can use as the basis for the bar.

There is a function in the Project window called Create → Custom Font. I had never noticed it before and assumed it was new for 2.6. This is what I’ve fruitlessly tried to use. Since it’s there, I assume it works, and I’m doing something wrong.

I find this information very interesting. It’s entire chapters of the reference manual I must have missed. What don’t you know, anyway?

Dunno if you’re still looking for a solution in order to import custom font, but I was working on the whole system for a while and I found interesting informations. Unfortunately, there are limitations, which is that your custom font must respect a fixed-grid size, in order to be imported correctly into your project. That’s a big issue for font optimisation and keeping your texture low.

I would Highly recommand those threads if you are still interested :

Custom Font Kerning
Custom font squished or cropped
new font() returns null
Access to Font Character Position
Custom Font - fill the m_CharacterRects vector - assign texture char position to it.

Hope it helps!