Author Topic: Center UIGrid In Panel  (Read 4100 times)

optimisticmonkey

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 15
    • View Profile
Center UIGrid In Panel
« 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Center UIGrid In Panel
« Reply #1 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.