Unity3d GUI.Label and GUISkin bug (in Unity 3.5.3)

by

Just ran into this apparent bug (which I reported to them) in Unity 3d v3.5.3f3 which I thought I’d document. Work-around included:

If you create a GUISkin and customize styles to use 24 point font GUI.Box and GUI.Button work as expected but GUI.Label does not pick up the font size set in the GUISkin.

The work-around is to use a Custom Styles gui skin style, in this case “myLabel” and then specify that to the third parameter to GUI.Label:

if ( GUI.Label( r, "hello", "myLabel" ) ) { ... }

will work and pick up your font size properly.

onward!

(A sample project demonstrating the bug & work-around is available here).

UPDATE: So, I ended up tracking this down and found that it’s the “Word Wrap” checkbox that causes the font size to be ignored.  You can use the default Label style as long as you uncheck the “Word Wrap” checkbox.  Clarified the bug with Unity so hopefully they’ll fix it sooner than later since Word Wrap is rather useful…

UPDATE 2: Turns out iOS doesn’t support dynamic fonts so to actually get the larger sized fonts there you have to import a font and set your GUISkin to use that.   Readable GUI elements on iPad 3 – yay!

Advertisements

Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: