Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: bitwalk on May 28, 2013, 08:52:33 AM
-
Hello!
I'm trying to get an UIGrid to be centered inside a panel but I can't seem to get it to work.
Here is my object tree:
GameObject (With UIAnchor set to bottom)
UIPanel (with clip region (pink box))
UIGrid (with two buttons in it and an UIAnchor set to center and with the parent UIPanel set as parent container)
Button1
Button2
I've attached a screenshot of how it looks. It appears as if it's centering on the center of the first button in the grid instead of the whole grid.
Any tips on how to get the grid centered appreciated, or if there's some other method of achieving this. I can't do manual centering since I want it to recenter if I change the number of buttons in the grid.
Thanks!
--Andreas
-
Why do you need that second UIAnchor? Position your UIGrid object once, and leave it there. UIGrid's children always extend to the right and below of the grid's transform's position.