Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Melkor on November 25, 2014, 10:13:32 AM

Title: UILabel - How to get the width of UILabel?
Post by: Melkor 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?
Title: Re: UILabel - How to get the width of UILabel?
Post by: ArenMook 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.