GUILabel wrong text wrapping when font changed by style

HI,

I’m having strange issue with chnaging fonst style. I’m doin g app for iOS but the issue shows up on payler in unity as well.
what I do I want to print GUI label with smaller text than default in current skin so I have defined another skin assigned smaller font to it and deriving font to GUI style from it. Then I use it with particular label.
this is exactly what I have written:

var smallFontStyle:GUIStyle;
smallFontStyle.font=skins[1].font;
GUILayout.Label ("this is longer text without breaklines",smallFontStyle);

result is text which breaks in 2 or 3 lines.
All ok so far, problem starts when I define width of label using UILayout.Width it shows only part of the text. As if it was doing it in one line but not appearing in full.

I tried also GUI lable with size defined with Rect but same issue shows up.
If I remove smallFontStyle definition text shows bigger (as default font in skin is) and it show in full as it should.

Don’t know what to do, spent hours playing with it. Just can’t print smaller font Label in one OnGUI call . Changing skin does distort all other text areas sizes if I do it before label I want to make smaller.

Also is it somehow possible to show GUI outline borders in editor player? would be bloody helpful for debugging.

Thnaks.

There’s other settings than just the font in your skin. Maybe the content offset, text clipping, word wrap, and/or alignment.
With that said, if you want it to be exactly the same as the default but smaller, you could just set the FontSize to be smaller before you draw this label, and then reset it to what it was after you draw it. Alternatively you could set your new style to be a copy of the old one, and then just change the font size there.

As far as GUI outlines in editor play, I don’t know how to do that, but what I use is a solid orange background. When I’m trying to get placement/size correct, I just set that element to have a solid orange background, and then I can see what size it’s actually drawing. It helps me more than you would think.