Me and my team are creating a game and we can't figure out how to change our style of font in our code. We have tried a couple different ways to do in none of which worked. Now we are down to one error:
*Assets/scripts/ScoreCount.js(6,40): BCE0051: Operator '<' cannot be used with a left hand side of type 'function(String): UnityEngine.Object' and a right hand side of type 'System.Type'.*
We are able to change size and color but not font.
static var gscore : int = 0;
function OnGUI() {
var font : Font;
var fontSize : int = 20;
GUI.style.font = Resources.Load("Fonts/Golden_Age");
GUI.contentColor = Color.green;
GUI.skin.label.font = GUI.skin.button.font = GUI.skin.box.font = font;
GUI.skin.label.fontSize = GUI.skin.box.fontSize = GUI.skin.button.fontSize = fontSize;
GUI.Label (Rect (10, 20, 200, 100), ("Score: " + gscore));
}
↧