Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Oakshiro on May 15, 2013, 02:54:20 AM
-
Hi there,
I know you can adjust the size of the panels to match a target height, but when creating mobile applications they are mostly in portrait mode. Wouldn't it be more adequate to set a target width and position the elements on the screen via UIAnchors?
Is there an easy way to modify UIRoot to use target Width instead of Height?
Thanks!
-
I'm also working on a game in portait mode and it would great to have an UIRoot that target width instead of height.
Is there a way to change that easily?
Best regards
Rampa
-
http://www.tasharen.com/forum/index.php?topic=2397.0
-
I saw that post previously, but it uses the "targetHeight" to calculate the size, therefore I supposed it was not Width based.
Is it that the targetHeight is being "hacked" to be used as Width ?
-
Whether you use height or width is arbitrary. It's used to set up a size for Virtual Pixels that split the screen into that many parts. If the virtual pixel height (UIRoot's activeheight) is the same as Screen.height, then Screen.width will also correspond to the coordinate system made by UIRoot (localPositions).
If you mess around with the manualHeight, then you need to calculate the corresponding width based on the aspect between height/width.
Externally in your own script, you can easily do these calculations and feed a manual height into UIRoot if you want to change it at runtime.