[Unity GUI筆記] JaveScript 關於更改GUI字型大小 (舊版UI)

詳細可以參考http://docs.unity3d.com/Documentation/ScriptReference/GUIStyle.html


==================
var style : GUIStyle;  //宣告出來可以直接在inspector看到(如上圖),這邊記錄一下從程式碼改

function Start() {
    style.fontSize = 15;  //改大小
    style.normal.textColor = Color.white; //改顏色
    style.fontStyle = FontStyle.Bold;  //改成粗體,詳細可以搜尋FontStyle
}

function OnGUI () {
    GUI.Label (Rect (50, 10, 200, 200), "Hello" , style);
}

留言