Author Topic: UILabel - How to get the width of UILabel?  (Read 2217 times)

Melkor

  • Newbie
  • *
  • Thank You
  • -Given: 7
  • -Receive: 0
  • Posts: 9
  • Whats the point of your existence?
    • View Profile
    • Denora Game Studios
UILabel - How to get the width of UILabel?
« on: November 25, 2014, 10:13:32 AM »
I am trying to get the width of UILabel but it seems it is not related to the screen but related to some virtual size of UIRoot? i do not understand this O_O
how can i get UILabel size related to the srceen like a normal Unity GUI and get and set its size?
None are more hopelessly enslaved than those who falsely believe they are free.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel - How to get the width of UILabel?
« Reply #1 on: November 26, 2014, 08:20:21 PM »
NGUI works with virtual pixels. This means that if the UIRoot is constrained, then it will always have the same size as far as UI is concerned, regardless of whether you're running it on 3840x2048 or 960x512. If you want to calculate actual pixels, use UIRoot's pixelSizeAdjustment or camera.WorldToScreenPoint.