pete43
1
Hello, Can someone please show me how to make this gui label score larger with cs code?
[38427-screen+shot+2015-01-07+at+6.10.34+pm.png|38427]
here is the code I’m using:
void OnGUI(){
GUI.color = Color.red;
GUILayout.Label(" Hit: " + score + "/" + spawnedObjects);
}
Thank you
Pete S.
Legacy GUI objects can take a GUIStyle object which can be assigned to a GUI Label. You can define the font size that will increase the displayable size of the text.
you can change the font size with code :
GUI.skin.textField.fontSize = SW/35;

textField can be a box or …
right click on “project” panel and from “create” menu choose “GUI Skin” . then create a new script and write :
var GUISKIN : GUISkin;
function OnGUI()
{
var SW = Screen.width; var SH = Screen.height;
GUI.skin = GUISKIN; GUI.skin.label.fontSize = SW/35;
GUI.Label(Rect(SW/2,SH/2,200,200),"AAAA");
}
assign your created GUI Skin to GUISKIN variable then test it