Got a game and it works great on windows and OSX. So time to try linux and see what happens. In short the game works, but any Unity GUI control has blank fonts. So GUILayout.Button(“Hello World”) shows a button with no text. Labels are the same.
If I make a call to “GUI.skin.button.font = f” where f is some font, then the font will show on all subsequent buttons. So it looks like something is hosed somewhere with Unity and the linux builds.
Is this a known issue? Is this a known issue with certain Linux distros (I’m using Debian 7.2 from a live CD). Is there some way to set the font used by all GUI controls easily? If so, what is the default font Unity uses (I need to make linux match OSX and Windows)?
Hey I’m not aware of such an issue. It would be ace if you could file a bug report via the editor and attach your project or a minimal repro project.
Thanks!
For anyone else who stumbles across this, here is how I managed to work around the problem.
1: Find the font that Unity uses by default. Don’t bother looking at the default skin you can get in the asset store. The ttf font file in that asset is empty. The font you want is already on most windows systems here c:\Windows\Fonts\arial.ttf
2: Put that ttf font in your assets folder and let unity import it. Then click the font in unity and change the font size to 13. It will default to 16, but you need to change it to 13 to match the default unity font size.
3: Very early in your project you need to call this from a script: “GUI.skin.font = thefont”. Here, ‘thefont’ is a reference to the font you imported.
Do these things and your linux GUI controls will rejoin the world is useful.
A few more notes below:
-If you get smart and try the following it won’t work. The font will still be blank in all your controls.
GUI.skin.font = Resources.GetBuiltinResource(“Arial.ttf”);
-If you investigate the problem and try ‘Debug.Log(GUI.skin.font)’ before you set the font you will see this:
“arial (UnityEngine.Font)”
So it looks like the font is there, but it sure doesn’t seem to work unless you load up some font of your own and jam it in the default skin.
If you do a development build and throw some exception, the GUI box that unity pops up (along with the two buttons) will also have blank fonts on linux until you set the font manually. So even if you don’t use any GUI yourself, but you need to do a development build and want to see any exceptions within the game, you need to set the font.
As for logging a bug… I’ll try to muster the energy. I know that unless I attach a bunch of stuff it will get ignored (that seemed to be the takeaway from this Unity Blog ). This is also a Linux bug related to the red headed stepchild that is the old unity GUI. Additionally, I have found a workaround. So I might have as much luck writing up the bug on paper and putting it in a bottle that is tossed in the Atlantic