Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: roberto_sc on February 03, 2014, 12:43:00 AM
-
I'm working on porting a game that was originally made to work in some resolutions, but now I have to support resizing (hence changing aspect ratio) during gameplay.
GUI elements are anchored so everything looks good when you start the game at a specific resolution. Also, UIRoot is set to FixedSize.
For supporting resizing I made a generic script that changes the Manual Height of the UIRoot proportionally with the new aspect ratio. So for example, when the window is rescaled to a narrower aspect ratio, the gui elements would be scaled to a smaller size to fit the width (imagine a horizontal toolbar of buttons that need to fit the width).
The problem with this solution is that some elements have a delta in their Y position to be properly positioned beneath another element, and changing the Manual Height of the UIRoot won't change this delta, so I end up with elements in wrong position or under other elements.
Is there a way to "reload" these elements, so their position and size can be recalculated based on the new aspect ratio?
-
Are you using the new anchor system or the old one? Old one generally has anchors run only once by default.
-
I'm using the old one.
-
Then uncheck the "run only once" option.