- Home /
Wierd GUI behaviour
I have a simple networked game, and whenever i make a build, the gui font seems to reset to Arial, but my font is comic sans ms, and so after i make a change in any script, even in a script thats not even in use, the font seems to go back to font i want it to be as. im using a guiskin with a font applied, also Guistyles with font applied
Is this only in a build, or does it happen while playing in the editor, too? If only a build, what platform?
Can you provide the OnGUI() code? If you're relying on a lot of default values for GUI.Label(), GUI.Button(), etc., you'll want to set GUI.skin = at the beginning of OnGUI().
its both in editor and on build ( tried mac, win, linux, web, flash too), and yes, ive set GUI.skin = $$anonymous$$ySkin; the boxes, windows, textfields are all part of my gui skin. and im using also using function GuiWindow() to make the windows, and the windows text seems to be the only problem
Is just the font reverting to default, or all of the style settings, too (size, color, etc.)?
What are your OnGUI() and window handler functions?
only the font, everything else stays as wanted, but the functions are simple (GUI.Box, GUI.Label, GUI.Window)
just a question, inside gui window functions, do i have to inroduce the GUI.skin = $$anonymous$$ySkin;?
I just tested this code, and it works fine:
public class WindowTest : $$anonymous$$onoBehaviour {
public GUISkin mySkin;
private Rect windowRect = new Rect (20, 20, 120, 50);
void OnGUI () {
if (mySkin != null) GUI.skin = mySkin;
windowRect = GUI.Window (0, windowRect, WindowFunction, "$$anonymous$$y Window");
}
void WindowFunction (int windowID) {
GUI.Label(new Rect(10, 10, 100, 20), "Label");
}
}
I created a new GUISkin, assigned a different TTF font to the Font field of the GUISkin, and then assigned my new GUISkin to the "mySkin" field of the script you see above. The window title and the label both used the new font.
Have you tried a different font?
What is your OnGUI() code?
Your answer
Follow this Question
Related Questions
Is there a way to measure the pixel with/height of a string with a given font? 2 Answers
Alpha not working in GUITex 0 Answers
Displaying Mathematical Equations 2 Answers
Unity 5.2 Using Emojii and other Unicode Symbols at Runtime UGUI 0 Answers
GUILabel wrong text wrapping when font changed by style 1 Answer