- Home /
How to set GUIStyle.font
I have a GUI element that I want to set a font to. I have a font called 'Kubasta.ttf' that is in Assets > font Then i call it like this:
void OnGUI() {
GUIStyle myStyle = new GUIStyle();
myStyle.font = kubasta;
GUI.Label(new Rect(10,10, 100, 30), "Hello World!", myStyle);
if (!kubasta) {
Debug.LogError("No font found, assign one in the inspector.");
return;
}
}
But i get the error 'Debug.LogError("No font found, assign one in the inspector." I've tried capitalising Kubasta and also adding .ttf at the end but this doesnt work.
Comment
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
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Can you use GUIStyle with GUILayout? 0 Answers
[SOLVED]GUIStyle Word Wrap Check 1 Answer