Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: btrikojus on February 05, 2015, 08:39:36 AM
-
Hi there,
Hoping this is possible. I have a UI panel that scales to fit the device's screen.
https://www.dropbox.com/s/7btmsf4eldhveje/Screenshot%202015-02-06%2000.24.01.png?dl=0 (https://www.dropbox.com/s/7btmsf4eldhveje/Screenshot%202015-02-06%2000.24.01.png?dl=0)
The UI root scaling style is set to flexible.
https://www.dropbox.com/s/cxdmuor0paa1epq/Screenshot%202015-02-06%2000.27.01.png?dl=0 (https://www.dropbox.com/s/cxdmuor0paa1epq/Screenshot%202015-02-06%2000.27.01.png?dl=0)
The UI panel has some children (buttons, slider etc) that I want to scale and move as the parent panel is scaled - so it is like it is a single object being scaled up and down.
Setting the anchors of a child to unified and setting the parent at the target works fine in the editor but falls down when the game is loaded on a device with a different resolution.
https://www.dropbox.com/s/37tk4r2vw130qmo/Screenshot%202015-02-06%2000.32.37.png?dl=0 (https://www.dropbox.com/s/37tk4r2vw130qmo/Screenshot%202015-02-06%2000.32.37.png?dl=0)
I've played around with different Anchor settings but can't get it to behave like this.
Thanks in advance
-
Think I might have stumbled across a solution. Setting the child anchors to unified, getting it working in the editor and then choosing "Set to current position" from each of the anchor dropdowns appears to have solved my problem. Is that the best solution?
Thanks
-
Pay close attention to the anchor targets. In your first screenshots you anchor left to left, right to right, but then top and bottom are both anchored to bottom. Your solution simply reset the anchor targets to be closest to whatever they were closest to at the time -- so for example if the button was in the bottom right corner, they'd be relative to the bottom right (left to right, right to right, bottom to bottom, top to bottom).