Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Markov on October 10, 2013, 03:05:11 PM
-
Hello. In new NGUI I can't get widget size in pixels.
I tried myWidget.localScale, all reloads of NGUIMath.CalculateRelativeWidgetBounds(), myWidget.width/height, all corners of myWidget...
I changed resolution of screen so the size of widget changed too(from very little to very big). And problem is that in code shows me that myWidget.width = 150 and height = 150 in ANY resolution and size of myWidget (all in editor mode)
How can I get actual size in pixels now?
-
Widget size won't change if you change the screen resolution. Not unless you have a stretch script on it. Widget size is always specified in pixels, and whether your screen is 1920x1080 or 640x480, a 150x150 pixel widget will always be 150x150.
If you're changing the UIRoot's manual height, then you need to take UIRoot.pixelSizeAdjustment into account.
-
Thanks, it works.
I request this feature in UIWidget. It's very handy :)