Author Topic: 3.0 and UILabel Scaling  (Read 12133 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.0 and UILabel Scaling
« Reply #15 on: September 24, 2013, 07:14:50 PM »
Dimensions define the area of the label, but nothing is preventing you from scaling it after the fact. It'd be weird if you couldn't. o_O

mishaps

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
Re: 3.0 and UILabel Scaling
« Reply #16 on: September 24, 2013, 07:16:53 PM »
Awesome man good to know :)

BGL

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: 3.0 and UILabel Scaling
« Reply #17 on: September 27, 2013, 10:42:55 AM »
Hi, I got a problem whenever I change by code the text in a UILabel with Overflow equal to ShrinkContent.
The Label change the size and so the text...overflow  :(
I think there is an issue in the method UILabel.MakePixelPerfect, at the end of the method there is a check to see if it is the case to change the size of the label, but I think the size of the label should not change in case of Overflow value is ShrinkContent. I do this fix:
  1.                         if (mOverflow != Overflow.ShrinkContent)
  2.                                 {
  3.                                         if (width < minX) width = minX;
  4.                                         if (height < minY) height = minY;
  5.                                 }
  6.  
What do you think?
Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.0 and UILabel Scaling
« Reply #18 on: September 27, 2013, 12:44:05 PM »
Confirmed, will fix. Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.0 and UILabel Scaling
« Reply #19 on: September 27, 2013, 01:15:20 PM »
Actually, thinking about it... the way it is now is correct. It is supposed to resize the label if it's too small. After all, "Make pixel perfect" is supposed to do just that -- make sure that everything is pixel perfect, and actually fits.

The problem is with the fact that setting UILabel.text calls MakePixelPerfect... and it shouldn't. I'll fix that.

MrTact

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 32
    • View Profile
Re: 3.0 and UILabel Scaling
« Reply #20 on: September 27, 2013, 02:39:25 PM »
Eh? You can change the scale of labels. Why not?
Ah, that's interesting - the scale is grayed out in the inspector. I assumed, like with sprites, that labels were blocked from being rescaled. That makes life a lot easier!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.0 and UILabel Scaling
« Reply #21 on: September 27, 2013, 06:12:41 PM »
They're not grayed out, just darkened. It's a suggestion -- "you likely won't need to modify this value".

merlin981

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: 3.0 and UILabel Scaling
« Reply #22 on: December 30, 2013, 12:20:19 PM »
Prior to NGUI 3, I used UIStretch to scale my UILabels for various resolutions. This worked perfectly, and was especially handy on the cross platform game I built (consoles, PC, and mobile devices).

However, with NGUI 3, UIStretch no longer scales UILabels. It actually seems to do nothing to the label. I've tried using extreme values just as a test, and the UILabel remained the same size.

I understand I can scale the UILabel using Unity's built-in Scale property in the inspector. However, the UIStretch was perfect for auto-scaling across multiple resolutions, and when used in conjunction with UIAnchor, was the best solution I'd found for anchoring and scaling my UI.

Aron, any suggestions on how to auto-scale a UILable in v3, or how to update UIStretch to work on UILabels again?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.0 and UILabel Scaling
« Reply #23 on: December 30, 2013, 01:31:36 PM »
See the other thread's reply. There is no need to post in multiple places.

http://www.tasharen.com/forum/index.php?topic=1582.msg34665#msg34665