Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: optimisticmonkey on December 07, 2013, 12:28:03 PM

Title: Center UIGrid In Panel
Post by: optimisticmonkey on December 07, 2013, 12:28:03 PM
I have a group of buttons I want centered in a panel that contains several things in it..

After right-clicking and adding a grid to the panel, and adding buttons to the grid, I can't get it to center in the panel.

I tried attaching a UIAnchor to the gameObject that contains the grid but that doesn't work...

Thanks in advance for any help
Title: Re: Center UIGrid In Panel
Post by: ArenMook on December 07, 2013, 03:24:08 PM
UIGrid is for run-time positioning. I don't recommend using it at edit-time unless you have to.

Instead, update to 3.0.7. Create a UIWidget covering the area you want each of your "cells" to be. Inside of it add your button. Use the new anchoring system if you want to make it relative to other buttons, or just drag the widget in the scene view. As you duplicate the widget with the button inside and drag it around, each will snap to its siblings automatically.