- Home /
Change default font for all Text etc
How can I define a default font for a project, so that I later easily can change it? I have included a couple of ttf/otf fonts in the Assets folder and will choose and pick from one of them.
So what you mean is there is no easy way? I have a ton of prefabs and whatnot in a number of scenes. I can't find them all that easily. I used to have a one liner for this in one of the professional 2D engines...
you could try the suggestion from the posted answer but it depends on whether you only have one font for everything or whether you have a number of them...seems like the former, so try using a guistyle, but i'm not sure how you'll apply it to all of your prefabs.
Answer by SeasiaInfotechind · Jan 07, 2015 at 11:55 AM
Hello Umai,
To define one font in your whole project you can take a variable of type GUIStyle and variable for font of type Font. For eg:
var myStyle : GUIStyle; var This_font : Font;
Now In the start() you can assign the font you want to be displayed in the game.
function Start () { //Here i am assigning the font to GUIStyle myStyle.font = large_font; // You can also adjust font size, font color and other properties of font here. myStyle.normal.textColor = Color.white; }
I hope this will help you. Thank you aK
Your answer
![](https://koobas.hobune.stream/wayback/20220613175808im_/https://answers.unity.com/themes/thub/images/avi.jpg)