Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: greyhoundgames on May 05, 2015, 11:06:53 AM

Title: UILabel that was TTF, then switches to NGUI still uses TTF var for checks
Post by: greyhoundgames on May 05, 2015, 11:06:53 AM
I had a TTF label that I made into a NGUI font label. I noticed there were some sizing problems. When i debugged into the code I saw that it was doing null checks on the ttf font which must still have been set in the serialization. Hence it got the default font size wrong. The label was experiencing some other incorrect behavior which I am hoping is related to this as well.
Title: Re: UILabel that was TTF, then switches to NGUI still uses TTF var for checks
Post by: r.pedra on May 05, 2015, 11:12:15 AM
We had the same problem, just switch on Unity font, make it null(remove the ttf from the UILabel) and switch again to NGUI Font. This way it should be null.
Title: Re: UILabel that was TTF, then switches to NGUI still uses TTF var for checks
Post by: greyhoundgames on May 05, 2015, 11:46:47 AM
I have about 2 billion labels, so hoping this can be fixed in the code :)
Title: Re: UILabel that was TTF, then switches to NGUI still uses TTF var for checks
Post by: ArenMook on May 05, 2015, 10:38:07 PM
How did you happen to do that? The UILabel.bitmapFont property intentionally clears the true type font reference right after assigning the bitmap value you passed to it...
Title: Re: UILabel that was TTF, then switches to NGUI still uses TTF var for checks
Post by: greyhoundgames on May 05, 2015, 11:07:03 PM
I had about 100 prefabs with labels that were all TTF fonts. I dropped them all in, in the filter box i typed in UILabel. Then with them all selected I clicked on the font type box and changed it to NGUI.

Then I applied all the prefabs.

How I noticed this problem in the first place is that the default font size # was showing 25 which was the UILabel.fontSize variable value instead of 64 which was the NGUI font file size.

Thats when i put a breakpoint in the UILabelInspector class and saw that the default font size getter was determining that the ttf font was not null and returning the font size itself.
Title: Re: UILabel that was TTF, then switches to NGUI still uses TTF var for checks
Post by: r.pedra on May 06, 2015, 08:42:07 AM
Aren, I already told you about a similar problem on this topic:
http://www.tasharen.com/forum/index.php?topic=12501.msg57019#msg57019
Title: Re: UILabel that was TTF, then switches to NGUI still uses TTF var for checks
Post by: ArenMook on May 07, 2015, 06:43:42 PM
I found the reason for this... label inspector was using Unity's serialized properties instead of actual class properties that would have set it properly.