Ok, so I have a script that includes a GUIStyle as a variable. I have attached that script to the main camera. In the script a label is rendered and assigned the GUIStyle. I also dynamiccally “pad” the string with spaces depending on the length of the string. This works fine, however if I change the font size and/or the font style (bold, italic, etc…), then it no longer even tries to pad the string… It has me entirely baffled. Furthermore, on a somewhat side-note, I noticed that, when changing something in the inspector related to a script, the changes are not directly represented in the script as well. This is confusing as it takes much tinkering to change a variable. Am I doing something wrong?
Anyway, here is the relevant pieces of the script file:
var textStyle : GUIStyle;
...
var currentExp : float = 20000.0f; //Static value given for testing
var tnl : float = 24000.0f; //Static value given for testing
...
var expRatioStr : String = currentExp + "/" + tnl;
...
function OnGUI()
{
...
if(expRatioStr.length < 20)
{
expRatioStr = " " + expRatioStr;
expRatioStr += " ";
}
...
GUI.Label(new Rect(660 * xScale, 468 * yScale, 60 * xScale, 10 * yScale), expRatioStr, textStyle2);
...
}
Anyone know why changing the GUIStyle prevents the whitespace from being added?